kamleshbhalui created this revision. kamleshbhalui added reviewers: rsmith, aaron.ballman, dblaikie. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Apply attributes on anonymous records. This Fixes https://bugs.llvm.org/show_bug.cgi?id=43983. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D71619 Files: clang/lib/Sema/SemaDecl.cpp clang/test/AST/pr43983.cpp Index: clang/test/AST/pr43983.cpp =================================================================== --- /dev/null +++ clang/test/AST/pr43983.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only %s -std=c++11 -ast-dump | FileCheck %s + +struct B { _Alignas(64) struct { int b; }; }; + +// CHECK: AlignedAttr {{.*}} _Alignas +// CHECK: ConstantExpr {{.*}} 64 +// CHECK: IntegerLiteral {{.*}} 64 Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -5020,6 +5020,7 @@ /*BitWidth=*/nullptr, /*Mutable=*/false, /*InitStyle=*/ICIS_NoInit); Anon->setAccess(AS); + ProcessDeclAttributes(S,Anon,Dc); if (getLangOpts().CPlusPlus) FieldCollector->Add(cast<FieldDecl>(Anon)); } else {
Index: clang/test/AST/pr43983.cpp =================================================================== --- /dev/null +++ clang/test/AST/pr43983.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only %s -std=c++11 -ast-dump | FileCheck %s + +struct B { _Alignas(64) struct { int b; }; }; + +// CHECK: AlignedAttr {{.*}} _Alignas +// CHECK: ConstantExpr {{.*}} 64 +// CHECK: IntegerLiteral {{.*}} 64 Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -5020,6 +5020,7 @@ /*BitWidth=*/nullptr, /*Mutable=*/false, /*InitStyle=*/ICIS_NoInit); Anon->setAccess(AS); + ProcessDeclAttributes(S,Anon,Dc); if (getLangOpts().CPlusPlus) FieldCollector->Add(cast<FieldDecl>(Anon)); } else {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits