forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -65,7 +65,7 @@ private:
|
||||
int m_chunkSize = 100;
|
||||
|
||||
bool m_flushRequested = false;
|
||||
unsigned m_flushLine = 0;
|
||||
int m_flushLine = 0;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user