Preprocessor: Fix client notification.

- Notify end of macro if function expansion is skipped.
- Do not notify client of generated macros expansion.

Change-Id: Ic027fc13ee391425a5ebadc8e84b9305912dbcf0
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
Francois Ferrand
2012-04-02 08:46:56 +02:00
committed by Roberto Raggi
parent 2355c4f809
commit 332072019a
2 changed files with 50 additions and 5 deletions

View File

@@ -800,14 +800,17 @@ bool Preprocessor::handleIdentifier(PPToken *tk)
return false;
// qDebug() << "expanding" << macro->name() << "on line" << tk->lineno;
if (m_client)
if (m_client && !tk->generated())
m_client->startExpandingMacro(tk->offset, *macro, macroName);
QVector<PPToken> body = macro->definitionTokens();
if (macro->isFunctionLike()) {
if (!expandMacros() || !handleFunctionLikeMacro(tk, macro, body, !m_state.m_inDefine))
if (!expandMacros() || !handleFunctionLikeMacro(tk, macro, body, !m_state.m_inDefine)) {
// the call is not function like or expandMacros() returns false, so stop
if (m_client && !tk->generated())
m_client->stopExpandingMacro(tk->offset, *macro);
return false;
}
}
@@ -829,7 +832,7 @@ bool Preprocessor::handleIdentifier(PPToken *tk)
m_state.pushTokenBuffer(body.begin(), body.end(), macro);
if (m_client)
if (m_client && !tk->generated())
m_client->stopExpandingMacro(tk->offset, *macro);
return true;