diff options
author | hjk <hjk@qt.io> | 2019-07-24 18:40:10 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-07-26 09:23:48 +0000 |
commit | 7ab6783e24c6a05a67f319817cd1bdd026a7ce43 (patch) | |
tree | 8b56ea311d333f45f300b915c3bd25a2b77b4aef /src/plugins/cpptools/cpprefactoringchanges.cpp | |
parent | eab0df22f98fab37585e4513de836a06e4aa05d5 (diff) | |
download | qt-creator-7ab6783e24c6a05a67f319817cd1bdd026a7ce43.tar.gz |
Standardize on int for line and column values
Recently tons of warnings show up for presumably "problematic"
singned <-> unsigned and size conversions.
The Qt side uses 'int', and that's the biggest 'integration surface'
for us, so instead of establishing some internal boundary between
signed and unsigned areas, push that boundary out of creator core code,
and use 'int' everywhere.
Because it reduces friction further, also do it in libcplusplus.
Change-Id: I84f3b79852c8029713e7ea6f133ffb9ef7030a70
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/cpptools/cpprefactoringchanges.cpp')
-rw-r--r-- | src/plugins/cpptools/cpprefactoringchanges.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/plugins/cpptools/cpprefactoringchanges.cpp b/src/plugins/cpptools/cpprefactoringchanges.cpp index f3c27073a9..4d16dd4813 100644 --- a/src/plugins/cpptools/cpprefactoringchanges.cpp +++ b/src/plugins/cpptools/cpprefactoringchanges.cpp @@ -159,7 +159,7 @@ void CppRefactoringFile::setCppDocument(Document::Ptr document) Scope *CppRefactoringFile::scopeAt(unsigned index) const { - unsigned line, column; + int line, column; cppDocument()->translationUnit()->getTokenStartPosition(index, &line, &column); return cppDocument()->scopeAt(line, column); } @@ -195,10 +195,10 @@ bool CppRefactoringFile::isCursorOn(const AST *ast) const Utils::ChangeSet::Range CppRefactoringFile::range(unsigned tokenIndex) const { const Token &token = tokenAt(tokenIndex); - unsigned line, column; + int line, column; cppDocument()->translationUnit()->getPosition(token.utf16charsBegin(), &line, &column); const int start = document()->findBlockByNumber(line - 1).position() + column - 1; - return {start, static_cast<int>(start + token.utf16chars())}; + return {start, start + token.utf16chars()}; } Utils::ChangeSet::Range CppRefactoringFile::range(AST *ast) const @@ -208,7 +208,7 @@ Utils::ChangeSet::Range CppRefactoringFile::range(AST *ast) const int CppRefactoringFile::startOf(unsigned index) const { - unsigned line, column; + int line, column; cppDocument()->translationUnit()->getPosition(tokenAt(index).utf16charsBegin(), &line, &column); return document()->findBlockByNumber(line - 1).position() + column - 1; } @@ -220,21 +220,21 @@ int CppRefactoringFile::startOf(const AST *ast) const int CppRefactoringFile::endOf(unsigned index) const { - unsigned line, column; + int line, column; cppDocument()->translationUnit()->getPosition(tokenAt(index).utf16charsEnd(), &line, &column); return document()->findBlockByNumber(line - 1).position() + column - 1; } int CppRefactoringFile::endOf(const AST *ast) const { - unsigned end = ast->lastToken(); + int end = ast->lastToken(); QTC_ASSERT(end > 0, return -1); return endOf(end - 1); } void CppRefactoringFile::startAndEndOf(unsigned index, int *start, int *end) const { - unsigned line, column; + int line, column; Token token(tokenAt(index)); cppDocument()->translationUnit()->getPosition(token.utf16charsBegin(), &line, &column); *start = document()->findBlockByNumber(line - 1).position() + column - 1; |