summaryrefslogtreecommitdiff
path: root/src/plugins/clangcodemodel
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-07-24 18:40:10 +0200
committerhjk <hjk@qt.io>2019-07-26 09:23:48 +0000
commit7ab6783e24c6a05a67f319817cd1bdd026a7ce43 (patch)
tree8b56ea311d333f45f300b915c3bd25a2b77b4aef /src/plugins/clangcodemodel
parenteab0df22f98fab37585e4513de836a06e4aa05d5 (diff)
downloadqt-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/clangcodemodel')
-rw-r--r--src/plugins/clangcodemodel/clangbackendreceiver.cpp10
-rw-r--r--src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp2
-rw-r--r--src/plugins/clangcodemodel/clangcurrentdocumentfilter.cpp2
-rw-r--r--src/plugins/clangcodemodel/clangfixitoperationsextractor.cpp2
-rw-r--r--src/plugins/clangcodemodel/clangfollowsymbol.cpp4
-rw-r--r--src/plugins/clangcodemodel/clanghighlightingresultreporter.h2
-rw-r--r--src/plugins/clangcodemodel/clangisdiagnosticrelatedtolocation.h12
7 files changed, 17 insertions, 17 deletions
diff --git a/src/plugins/clangcodemodel/clangbackendreceiver.cpp b/src/plugins/clangcodemodel/clangbackendreceiver.cpp
index 34e3136830..7f2ef28fd6 100644
--- a/src/plugins/clangcodemodel/clangbackendreceiver.cpp
+++ b/src/plugins/clangcodemodel/clangbackendreceiver.cpp
@@ -219,7 +219,7 @@ CppTools::CursorInfo::Range toCursorInfoRange(const SourceRangeContainer &source
{
const SourceLocationContainer &start = sourceRange.start;
const SourceLocationContainer &end = sourceRange.end;
- const unsigned length = end.column - start.column;
+ const int length = end.column - start.column;
return {start.line, start.column, length};
}
@@ -249,10 +249,10 @@ CppTools::SymbolInfo toSymbolInfo(const FollowSymbolMessage &message)
const SourceLocationContainer &start = range.start;
const SourceLocationContainer &end = range.end;
- result.startLine = static_cast<int>(start.line);
- result.startColumn = static_cast<int>(start.column);
- result.endLine = static_cast<int>(end.line);
- result.endColumn = static_cast<int>(end.column);
+ result.startLine = start.line;
+ result.startColumn = start.column;
+ result.endLine = end.line;
+ result.endColumn = end.column;
result.fileName = start.filePath;
result.isResultOnlyForFallBack = message.result.isResultOnlyForFallBack;
diff --git a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp
index 6f1397c487..09f5ee9507 100644
--- a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp
+++ b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp
@@ -189,7 +189,7 @@ CodeCompletions ClangCompletionAssistProcessor::applyCompletionFixIt(const CodeC
ClangFixItOperation fixItOperation(Utf8String(), completion.requiredFixIts);
fixItOperation.perform();
- const int fixItLength = static_cast<int>(fixIt.range.end.column - fixIt.range.start.column);
+ const int fixItLength = fixIt.range.end.column - fixIt.range.start.column;
const QString fixItText = fixIt.text.toString();
m_positionForProposal += fixItText.length() - fixItLength;
diff --git a/src/plugins/clangcodemodel/clangcurrentdocumentfilter.cpp b/src/plugins/clangcodemodel/clangcurrentdocumentfilter.cpp
index cd90c29fb4..20d4cf707a 100644
--- a/src/plugins/clangcodemodel/clangcurrentdocumentfilter.cpp
+++ b/src/plugins/clangcodemodel/clangcurrentdocumentfilter.cpp
@@ -75,7 +75,7 @@ static Core::LocatorFilterEntry makeEntry(Core::ILocatorFilter *filter,
{
const ClangBackEnd::ExtraInfo &extraInfo = info.extraInfo;
QString displayName = extraInfo.token;
- ::Utils::LineColumn lineColumn(static_cast<int>(info.line), static_cast<int>(info.column));
+ ::Utils::LineColumn lineColumn(info.line, info.column);
Core::LocatorFilterEntry entry(filter, displayName, QVariant::fromValue(lineColumn));
QString extra;
ClangBackEnd::HighlightingType mainType = info.types.mainHighlightingType;
diff --git a/src/plugins/clangcodemodel/clangfixitoperationsextractor.cpp b/src/plugins/clangcodemodel/clangfixitoperationsextractor.cpp
index 981a679a9b..72d52cb81b 100644
--- a/src/plugins/clangcodemodel/clangfixitoperationsextractor.cpp
+++ b/src/plugins/clangcodemodel/clangfixitoperationsextractor.cpp
@@ -63,7 +63,7 @@ bool hasFixItAt(const QVector<ClangBackEnd::FixItContainer> &fixits,
{
const auto isFixitForLocation = [filePath, line] (const ClangBackEnd::FixItContainer &fixit) {
const ClangBackEnd::SourceLocationContainer &location = fixit.range.start;
- return location.filePath == filePath && location.line == uint(line);
+ return location.filePath == filePath && location.line == line;
};
return Utils::anyOf(fixits, isFixitForLocation);
diff --git a/src/plugins/clangcodemodel/clangfollowsymbol.cpp b/src/plugins/clangcodemodel/clangfollowsymbol.cpp
index e03a2b904c..58adcacee2 100644
--- a/src/plugins/clangcodemodel/clangfollowsymbol.cpp
+++ b/src/plugins/clangcodemodel/clangfollowsymbol.cpp
@@ -43,8 +43,8 @@ namespace Internal {
// Returns invalid Mark if it is not found at (line, column)
static bool findMark(const QVector<ClangBackEnd::TokenInfoContainer> &marks,
- uint line,
- uint column,
+ int line,
+ int column,
ClangBackEnd::TokenInfoContainer &mark)
{
mark = Utils::findOrDefault(marks,
diff --git a/src/plugins/clangcodemodel/clanghighlightingresultreporter.h b/src/plugins/clangcodemodel/clanghighlightingresultreporter.h
index 2c6e7a89a8..b3755fd264 100644
--- a/src/plugins/clangcodemodel/clanghighlightingresultreporter.h
+++ b/src/plugins/clangcodemodel/clanghighlightingresultreporter.h
@@ -65,7 +65,7 @@ private:
int m_chunkSize = 100;
bool m_flushRequested = false;
- unsigned m_flushLine = 0;
+ int m_flushLine = 0;
};
} // namespace Internal
diff --git a/src/plugins/clangcodemodel/clangisdiagnosticrelatedtolocation.h b/src/plugins/clangcodemodel/clangisdiagnosticrelatedtolocation.h
index 6a88a1fd22..c8de24a0d0 100644
--- a/src/plugins/clangcodemodel/clangisdiagnosticrelatedtolocation.h
+++ b/src/plugins/clangcodemodel/clangisdiagnosticrelatedtolocation.h
@@ -31,8 +31,8 @@ namespace ClangCodeModel {
namespace Internal {
static bool isWithinRange(const ClangBackEnd::SourceRangeContainer &range,
- uint line,
- uint column)
+ int line,
+ int column)
{
const ClangBackEnd::SourceLocationContainer &startLocation = range.start;
const ClangBackEnd::SourceLocationContainer &endLocation = range.end;
@@ -44,8 +44,8 @@ static bool isWithinRange(const ClangBackEnd::SourceRangeContainer &range,
}
static bool isWithinOneRange(const QVector<ClangBackEnd::SourceRangeContainer> &ranges,
- uint line,
- uint column)
+ int line,
+ int column)
{
for (const ClangBackEnd::SourceRangeContainer &range : ranges) {
if (isWithinRange(range, line, column))
@@ -57,8 +57,8 @@ static bool isWithinOneRange(const QVector<ClangBackEnd::SourceRangeContainer> &
bool isDiagnosticRelatedToLocation(const ClangBackEnd::DiagnosticContainer &diagnostic,
const QVector<ClangBackEnd::SourceRangeContainer> &additionalRanges,
- uint line,
- uint column)
+ int line,
+ int column)
{
const ClangBackEnd::SourceLocationContainer &location = diagnostic.location;