[PATCH] D71619: [CLANG] Alignment specifier not applied to anonymous structure or union

kamlesh kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 17 10:06:45 PST 2019


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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71619.234334.patch
Type: text/x-patch
Size: 836 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191217/2d0db499/attachment.bin>


More information about the cfe-commits mailing list