diff --git a/tests/manual/cplusplus/main.cpp b/tests/manual/cplusplus/main.cpp index e5a68d4058686f9d273dd1e409719c94061ac2fc..b4b9b8456d8bbc0a14df918fad613f514723afd0 100644 --- a/tests/manual/cplusplus/main.cpp +++ b/tests/manual/cplusplus/main.cpp @@ -119,6 +119,25 @@ public: } protected: + bool isEnumOrTypedefEnum(SpecifierAST *spec) { + if (! spec) + return false; + if (SimpleSpecifierAST *simpleSpec = spec->asSimpleSpecifier()) { + if (tokenKind(simpleSpec->specifier_token) == T_TYPEDEF) + return isEnumOrTypedefEnum(spec->next); + } + return spec->asEnumSpecifier() != 0; + } + virtual bool visit(SimpleDeclarationAST *ast) { + if (isEnumOrTypedefEnum(ast->decl_specifier_seq)) { + //remove(ast->firstToken(), ast->lastToken()); + insertTextBefore(ast->firstToken(), "/* #REF# removed "); + insertTextAfter(ast->lastToken() - 1, "*/"); + return true; + } + return true; + } + virtual bool visit(AccessDeclarationAST *ast) { if (tokenKind(ast->access_specifier_token) == T_PRIVATE) { @@ -164,7 +183,11 @@ protected: if (ast->lbrace_token) insertTextAfter(ast->lbrace_token, " Q_OBJECT\n"); - return true; + for (DeclarationAST *it = ast->member_specifiers; it; it = it->next) { + accept(it); + } + + return false; } };