CPlusPlus: Support C++11 attributes also for function parameters

Fixes: QTCREATORBUG-24636
Change-Id: I9dc3d2cc6ca102b09f6b040455fa901c362dae7d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2020-11-11 17:35:05 +01:00
parent 59f8bd4702
commit dc66d30076
2 changed files with 6 additions and 1 deletions

View File

@@ -2113,6 +2113,11 @@ bool Parser::parseParameterDeclarationList(ParameterDeclarationListAST *&node)
bool Parser::parseParameterDeclaration(ParameterDeclarationAST *&node)
{
DEBUG_THIS_RULE();
if (_languageFeatures.cxx11Enabled) {
SpecifierListAST *attr_specifier_seq = nullptr;
while (parseStdAttributeSpecifier(attr_specifier_seq))
;
}
SpecifierListAST *decl_specifier_seq = nullptr;
if (parseDeclSpecifierSeq(decl_specifier_seq)) {
ParameterDeclarationAST *ast = new (_pool) ParameterDeclarationAST;

View File

@@ -1338,7 +1338,7 @@ void tst_AST::cpp11_variadic_inheritance()
void tst_AST::cpp11_attributes()
{
QSharedPointer<TranslationUnit> unit(parseDeclaration(
"[[noreturn]] void f() {throw \"error\";}",
"[[noreturn]] void f([[maybe_unused]] int v) {throw \"error\";}",
false, false, true));
AST *ast = unit->ast();
QVERIFY(ast != nullptr);