forked from qt-creator/qt-creator
Clang: Add commentary about column convertion
... to/from utf8 byte offset used by Clang. Change-Id: I294d6cd61b416e5f2d64206ee2f3f1b4a91fb1d3 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -100,6 +100,9 @@ SourceLocation::SourceLocation(CXTranslationUnit cxTranslationUnit,
|
||||
const char *contents = clang_getFileContents(cxTranslationUnit, cxFile, nullptr);
|
||||
if (!contents)
|
||||
return;
|
||||
// (1) column in SourceLocation is the actual column shown by CppEditor.
|
||||
// (2) column in Clang is the utf8 byte offset from the beginning of the line.
|
||||
// Here we convert column from (2) to (1).
|
||||
column_ = static_cast<uint>(QString::fromUtf8(&contents[lineStart],
|
||||
static_cast<int>(column_)).size());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user