forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user