forked from qt-creator/qt-creator
C++: TranslationUnit::getPosition takes utf16char offsets
...and not byte offsets anymore. This is necessary in order to calculate the line and column numbers correctly with respect to unicode code points. Change-Id: I5d79857b3eaefeb8d563b4f1e3938a64debc5e08 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -98,7 +98,7 @@ void CppTodoItemsScanner::processDocument(CPlusPlus::Document::Ptr doc)
|
||||
const QStringList commentLines =
|
||||
QString::fromUtf8(source).split(QLatin1Char('\n'), QString::SkipEmptyParts);
|
||||
unsigned lineNumber = 0;
|
||||
translationUnit->getPosition(token.bytesBegin(), &lineNumber);
|
||||
translationUnit->getPosition(token.utf16charsBegin(), &lineNumber);
|
||||
for (int j = 0; j < commentLines.count(); ++j) {
|
||||
const QString &commentLine = commentLines.at(j);
|
||||
processCommentLine(doc->fileName(), commentLine, lineNumber + j, itemList);
|
||||
|
||||
Reference in New Issue
Block a user