diff options
author | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2018-01-26 17:04:38 +0100 |
---|---|---|
committer | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2018-02-01 12:22:45 +0000 |
commit | fbbdfd24446c12eff7761d16c6acbf8e24985a5c (patch) | |
tree | 0a3354b819c16b29390f4911db576b30b31bf0e3 /src/tools/clangbackend/source/sourcelocation.cpp | |
parent | 0c50d54da7439fd4c2a56abab9781ceeff0e28b6 (diff) | |
download | qt-creator-fbbdfd24446c12eff7761d16c6acbf8e24985a5c.tar.gz |
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>
Diffstat (limited to 'src/tools/clangbackend/source/sourcelocation.cpp')
-rw-r--r-- | src/tools/clangbackend/source/sourcelocation.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/tools/clangbackend/source/sourcelocation.cpp b/src/tools/clangbackend/source/sourcelocation.cpp index 41f68a9ae6..77fd9e61da 100644 --- a/src/tools/clangbackend/source/sourcelocation.cpp +++ b/src/tools/clangbackend/source/sourcelocation.cpp @@ -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()); } |