Disable macro expansion when preprocessing in fast-mode.

This commit is contained in:
Roberto Raggi
2009-07-04 20:54:31 +02:00
parent 93cdff1818
commit 2f649be146
3 changed files with 23 additions and 4 deletions

View File

@@ -533,7 +533,8 @@ Preprocessor::Preprocessor(Client *client, Environment *env)
env(env),
_expand(env),
_result(0),
_markGeneratedTokens(false)
_markGeneratedTokens(false),
_expandMacros(true)
{
resetIfLevel ();
}
@@ -620,6 +621,16 @@ void Preprocessor::out(const char *s)
_result->append(s);
}
bool Preprocessor::expandMacros() const
{
return _expandMacros;
}
void Preprocessor::setExpandMacros(bool expandMacros)
{
_expandMacros = expandMacros;
}
Preprocessor::State Preprocessor::createStateFromSource(const QByteArray &source) const
{
State state;
@@ -806,8 +817,12 @@ void Preprocessor::preprocess(const QString &fileName, const QByteArray &source,
++_dot; // skip T_IDENTIFIER
const QByteArray spell = tokenSpell(*identifierToken);
if (! _expandMacros) {
out(spell);
continue;
}
if (env->isBuiltinMacro(spell))
else if (env->isBuiltinMacro(spell))
expandBuiltinMacro(identifierToken, spell);
else {