[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
Thu Dec 19 15:30:38 PST 2019


kamleshbhalui updated this revision to Diff 234796.
kamleshbhalui added a comment.

removed c++11 from the test.
I do not have commit access, Can someone commit this for me?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71619/new/

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 -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,8 @@
         /*BitWidth=*/nullptr, /*Mutable=*/false,
         /*InitStyle=*/ICIS_NoInit);
     Anon->setAccess(AS);
+    ProcessDeclAttributes(S, Anon, Dc);
+
     if (getLangOpts().CPlusPlus)
       FieldCollector->Add(cast<FieldDecl>(Anon));
   } else {
@@ -5033,6 +5035,7 @@
       SC = SC_None;
     }
 
+    assert(DS.getAttributes().empty() && "No attribute expected");
     Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(),
                            Record->getLocation(), /*IdentifierInfo=*/nullptr,
                            Context.getTypeDeclType(Record), TInfo, SC);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71619.234796.patch
Type: text/x-patch
Size: 1163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191219/854ecf91/attachment.bin>


More information about the cfe-commits mailing list