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:
@@ -291,41 +291,51 @@ static inline const Macro revision(const CppModelManagerInterface::WorkingCopy &
|
||||
return newMacro;
|
||||
}
|
||||
|
||||
void CppPreprocessor::passedMacroDefinitionCheck(unsigned offset, unsigned line, const Macro ¯o)
|
||||
void CppPreprocessor::passedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charsOffset,
|
||||
unsigned line, const Macro ¯o)
|
||||
{
|
||||
if (!m_currentDoc)
|
||||
return;
|
||||
|
||||
m_currentDoc->addMacroUse(revision(m_workingCopy, macro), offset, macro.name().length(), line,
|
||||
QVector<MacroArgumentReference>());
|
||||
m_currentDoc->addMacroUse(revision(m_workingCopy, macro),
|
||||
bytesOffset, macro.name().length(),
|
||||
utf16charsOffset, macro.nameToQString().size(),
|
||||
line, QVector<MacroArgumentReference>());
|
||||
}
|
||||
|
||||
void CppPreprocessor::failedMacroDefinitionCheck(unsigned offset, const ByteArrayRef &name)
|
||||
void CppPreprocessor::failedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charOffset,
|
||||
const ByteArrayRef &name)
|
||||
{
|
||||
if (!m_currentDoc)
|
||||
return;
|
||||
|
||||
m_currentDoc->addUndefinedMacroUse(QByteArray(name.start(), name.size()), offset);
|
||||
m_currentDoc->addUndefinedMacroUse(QByteArray(name.start(), name.size()),
|
||||
bytesOffset, utf16charOffset);
|
||||
}
|
||||
|
||||
void CppPreprocessor::notifyMacroReference(unsigned offset, unsigned line, const Macro ¯o)
|
||||
void CppPreprocessor::notifyMacroReference(unsigned bytesOffset, unsigned utf16charOffset,
|
||||
unsigned line, const Macro ¯o)
|
||||
{
|
||||
if (!m_currentDoc)
|
||||
return;
|
||||
|
||||
m_currentDoc->addMacroUse(revision(m_workingCopy, macro), offset, macro.name().length(), line,
|
||||
QVector<MacroArgumentReference>());
|
||||
m_currentDoc->addMacroUse(revision(m_workingCopy, macro),
|
||||
bytesOffset, macro.name().length(),
|
||||
utf16charOffset, macro.nameToQString().size(),
|
||||
line, QVector<MacroArgumentReference>());
|
||||
}
|
||||
|
||||
void CppPreprocessor::startExpandingMacro(unsigned offset, unsigned line,
|
||||
const Macro ¯o,
|
||||
void CppPreprocessor::startExpandingMacro(unsigned bytesOffset, unsigned utf16charOffset,
|
||||
unsigned line, const Macro ¯o,
|
||||
const QVector<MacroArgumentReference> &actuals)
|
||||
{
|
||||
if (!m_currentDoc)
|
||||
return;
|
||||
|
||||
m_currentDoc->addMacroUse(revision(m_workingCopy, macro), offset, macro.name().length(), line,
|
||||
actuals);
|
||||
m_currentDoc->addMacroUse(revision(m_workingCopy, macro),
|
||||
bytesOffset, macro.name().length(),
|
||||
utf16charOffset, macro.nameToQString().size(),
|
||||
line, actuals);
|
||||
}
|
||||
|
||||
void CppPreprocessor::stopExpandingMacro(unsigned, const Macro &)
|
||||
@@ -366,16 +376,16 @@ void CppPreprocessor::mergeEnvironment(Document::Ptr doc)
|
||||
m_env.addMacros(doc->definedMacros());
|
||||
}
|
||||
|
||||
void CppPreprocessor::startSkippingBlocks(unsigned offset)
|
||||
void CppPreprocessor::startSkippingBlocks(unsigned utf16charsOffset)
|
||||
{
|
||||
if (m_currentDoc)
|
||||
m_currentDoc->startSkippingBlocks(offset);
|
||||
m_currentDoc->startSkippingBlocks(utf16charsOffset);
|
||||
}
|
||||
|
||||
void CppPreprocessor::stopSkippingBlocks(unsigned offset)
|
||||
void CppPreprocessor::stopSkippingBlocks(unsigned utf16charsOffset)
|
||||
{
|
||||
if (m_currentDoc)
|
||||
m_currentDoc->stopSkippingBlocks(offset);
|
||||
m_currentDoc->stopSkippingBlocks(utf16charsOffset);
|
||||
}
|
||||
|
||||
void CppPreprocessor::sourceNeeded(unsigned line, const QString &fileName, IncludeType type)
|
||||
|
||||
Reference in New Issue
Block a user