diff options
author | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2014-05-09 10:04:13 -0400 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2014-05-23 14:34:01 +0200 |
commit | c6358e5d380c18f3ebff148a095ddf3a9d6b266c (patch) | |
tree | 84fc2fa9919e2d57720ae3944e2d3a94b6c28c68 /src/libs/cplusplus/FastPreprocessor.cpp | |
parent | bb7da966b801a2884cd7cf47f640bf7ac7d775df (diff) | |
download | qt-creator-c6358e5d380c18f3ebff148a095ddf3a9d6b266c.tar.gz |
C++: Add utf16 indices to Macro and Document::MacroUse
In most cases we need to work with the utf16 indices. Only in
cppfindreferences the byte interface is still needed since there we read
in files and work on a QByteArray to save memory.
Change-Id: I6ef6a93fc1875a8c9a305c075d51a9ca034c41bb
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/libs/cplusplus/FastPreprocessor.cpp')
-rw-r--r-- | src/libs/cplusplus/FastPreprocessor.cpp | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/libs/cplusplus/FastPreprocessor.cpp b/src/libs/cplusplus/FastPreprocessor.cpp index 5c52764cf5..c49695fc8c 100644 --- a/src/libs/cplusplus/FastPreprocessor.cpp +++ b/src/libs/cplusplus/FastPreprocessor.cpp @@ -108,37 +108,45 @@ static const Macro revision(const Snapshot &s, const Macro &m) return m; } -void FastPreprocessor::passedMacroDefinitionCheck(unsigned offset, unsigned line, const Macro ¯o) +void FastPreprocessor::passedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charsOffset, + unsigned line, const Macro ¯o) { Q_ASSERT(_currentDoc); _currentDoc->addMacroUse(revision(_snapshot, macro), - offset, macro.name().length(), line, - QVector<MacroArgumentReference>()); + bytesOffset, macro.name().size(), + utf16charsOffset, macro.nameToQString().size(), + line, QVector<MacroArgumentReference>()); } -void FastPreprocessor::failedMacroDefinitionCheck(unsigned offset, const ByteArrayRef &name) +void FastPreprocessor::failedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charsOffset, + const ByteArrayRef &name) { Q_ASSERT(_currentDoc); - _currentDoc->addUndefinedMacroUse(QByteArray(name.start(), name.size()), offset); + _currentDoc->addUndefinedMacroUse(QByteArray(name.start(), name.size()), + bytesOffset, utf16charsOffset); } -void FastPreprocessor::notifyMacroReference(unsigned offset, unsigned line, const Macro ¯o) +void FastPreprocessor::notifyMacroReference(unsigned bytesOffset, unsigned utf16charsOffset, + unsigned line, const Macro ¯o) { Q_ASSERT(_currentDoc); _currentDoc->addMacroUse(revision(_snapshot, macro), - offset, macro.name().length(), line, - QVector<MacroArgumentReference>()); + bytesOffset, macro.name().size(), + utf16charsOffset, macro.nameToQString().size(), + line, QVector<MacroArgumentReference>()); } -void FastPreprocessor::startExpandingMacro(unsigned offset, unsigned line, - const Macro ¯o, - const QVector<MacroArgumentReference> &actuals) +void FastPreprocessor::startExpandingMacro(unsigned bytesOffset, unsigned utf16charsOffset, + unsigned line, const Macro ¯o, + const QVector<MacroArgumentReference> &actuals) { Q_ASSERT(_currentDoc); _currentDoc->addMacroUse(revision(_snapshot, macro), - offset, macro.name().length(), line, actuals); + bytesOffset, macro.name().size(), + utf16charsOffset, macro.nameToQString().size(), + line, actuals); } |