diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index 4d86c52d742c9e0d34d7570c670032fd9ce8f70f..3f1b1aff944031eb3d0578481389d22ed315136f 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -444,12 +444,12 @@ QByteArray Snapshot::preprocessedCode(const QString &source, const QString &file Document::Ptr Snapshot::documentFromSource(const QByteArray &preprocessedCode, const QString &fileName) const { - FastPreprocessor pp(*this); Document::Ptr newDoc = Document::create(fileName); if (Document::Ptr thisDocument = value(fileName)) { newDoc->_includes = thisDocument->_includes; newDoc->_definedMacros = thisDocument->_definedMacros; + newDoc->_macroUses = thisDocument->_macroUses; } newDoc->setSource(preprocessedCode); diff --git a/src/libs/cplusplus/CppDocument.h b/src/libs/cplusplus/CppDocument.h index ca15bd1986d761cfa29b215fe6940638b296f2de..6a9896a531798af133598319ed033422fb5a022c 100644 --- a/src/libs/cplusplus/CppDocument.h +++ b/src/libs/cplusplus/CppDocument.h @@ -189,6 +189,15 @@ public: : _begin(begin), _end(end) { } + inline bool isNull() const + { return length() == 0; } + + inline unsigned position() const + { return _begin; } + + inline unsigned length() const + { return _end - _begin; } + inline unsigned begin() const { return _begin; } diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index dcb6d4932223f7df5b1adb2da49583e1a2932e9b..5ce662b9981af2aca9d19b8914bd7ef94fcc892b 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -975,18 +975,9 @@ Macro *Preprocessor::processObjectLikeMacro(TokenIterator identifierToken, void Preprocessor::expandBuiltinMacro(TokenIterator identifierToken, const QByteArray &spell) { - const Macro trivial; - - if (client) - client->startExpandingMacro(identifierToken->offset, - trivial, spell); - const bool was = markGeneratedTokens(true, identifierToken); expand(spell, _result); (void) markGeneratedTokens(was); - - if (client) - client->stopExpandingMacro(_dot->offset, trivial); } void Preprocessor::expandObjectLikeMacro(TokenIterator identifierToken, diff --git a/src/libs/cplusplus/pp-macro-expander.cpp b/src/libs/cplusplus/pp-macro-expander.cpp index 42be634562d445eafebffe413820cd8c969d2300..1c7a872689eafcda93e4042e9df7a540dcb834a3 100644 --- a/src/libs/cplusplus/pp-macro-expander.cpp +++ b/src/libs/cplusplus/pp-macro-expander.cpp @@ -287,9 +287,6 @@ const char *MacroExpander::expand(const char *__first, const char *__last, if (! macro->definition().isEmpty()) { - if (client) - client->startExpandingMacro(start_offset + (name_begin-start), *macro, fast_name, true); - macro->setHidden(true); QByteArray __tmp; @@ -316,9 +313,6 @@ const char *MacroExpander::expand(const char *__first, const char *__last, } macro->setHidden(false); - - if (client) - client->stopExpandingMacro(start_offset + (name_begin-start), *macro); } if (! m) @@ -375,17 +369,11 @@ const char *MacroExpander::expand(const char *__first, const char *__last, ++arg_it; // skip ')' __first = arg_it; - if (client) - client->startExpandingMacro(start_offset + (name_begin-start), *macro, fast_name, true, actuals_ref); - pp_frame frame (macro, actuals); MacroExpander expand_macro (env, &frame); macro->setHidden(true); expand_macro (macro->definition(), __result); macro->setHidden(false); - - if (client) - client->stopExpandingMacro(start_offset + (name_begin-start), *macro); } else __result->append(*__first++);