CPlusPlus: Block function-like macro name for arguments expansion

Arguments of funstion-like macro may contain the name of this
macro. The attempt to expand it results into infinite recursion.

Patch solves that by saving the macro name until the arguments
are collected to determine that it should not be expanded.

Fixes: QTCREATORBUG-21642
Change-Id: Iafb404ecd3959a2f1011c12c1c3f1c0c54ed3547
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
This commit is contained in:
Ivan Donchevskii
2019-01-10 14:44:56 +01:00
committed by Erik Verbruggen
parent 66dc5e9713
commit 645bbf5dd6
3 changed files with 83 additions and 11 deletions

View File

@@ -220,7 +220,8 @@ private:
bool scanComment(PPToken *tk);
bool consumeComments(PPToken *tk);
bool collectActualArguments(PPToken *tk, QVector<QVector<PPToken> > *actuals);
bool collectActualArguments(PPToken *tk, QVector<QVector<PPToken> > *actuals,
const QByteArray &parentMacroName);
void scanActualArgument(PPToken *tk, QVector<PPToken> *tokens);
void handlePreprocessorDirective(PPToken *tk);