forked from qt-creator/qt-creator
Disable macro expansion when preprocessing in fast-mode.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user