]> granicus.if.org Git - clang/commitdiff
Clean up alignment hacks now that MSVC 2013 and GCC 4.7 are gone.
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 20 Oct 2016 13:52:26 +0000 (13:52 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 20 Oct 2016 13:52:26 +0000 (13:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284729 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Stmt.h
include/clang/AST/TemplateBase.h
include/clang/Sema/DeclSpec.h
include/clang/Sema/TemplateDeduction.h

index 562b49a366faf97d2411ff34155e620d33b616c6..a413f2546484ef7daf22775cd3a25e82d7864858 100644 (file)
@@ -56,7 +56,7 @@ namespace clang {
 
 /// Stmt - This represents one statement.
 ///
-class LLVM_ALIGNAS(LLVM_PTR_SIZE) Stmt {
+class alignas(void *) Stmt {
 public:
   enum StmtClass {
     NoStmtClass = 0,
index b9c2c08943e95162f0bb59eb7fcc1337259e92fe..bccb5787925941ad6dd0489d4215479d4e753abb 100644 (file)
@@ -607,7 +607,7 @@ public:
 /// as such, doesn't contain the array of TemplateArgumentLoc itself,
 /// but expects the containing object to also provide storage for
 /// that.
-struct LLVM_ALIGNAS(LLVM_PTR_SIZE) ASTTemplateKWAndArgsInfo {
+struct alignas(void *) ASTTemplateKWAndArgsInfo {
   /// \brief The source location of the left angle bracket ('<').
   SourceLocation LAngleLoc;
 
index df434ec778ff6382de12c7f754be0f5689b103aa..8f5bd04f1125dd6c350b2876d62f4512f2209f0c 100644 (file)
@@ -1417,15 +1417,12 @@ struct DeclaratorChunk {
     unsigned TypeQuals : 5;
     // CXXScopeSpec has a constructor, so it can't be a direct member.
     // So we need some pointer-aligned storage and a bit of trickery.
-    union {
-      void *Aligner;
-      char Mem[sizeof(CXXScopeSpec)];
-    } ScopeMem;
+    alignas(CXXScopeSpec) char ScopeMem[sizeof(CXXScopeSpec)];
     CXXScopeSpec &Scope() {
-      return *reinterpret_cast<CXXScopeSpec*>(ScopeMem.Mem);
+      return *reinterpret_cast<CXXScopeSpec *>(ScopeMem);
     }
     const CXXScopeSpec &Scope() const {
-      return *reinterpret_cast<const CXXScopeSpec*>(ScopeMem.Mem);
+      return *reinterpret_cast<const CXXScopeSpec *>(ScopeMem);
     }
     void destroy() {
       Scope().~CXXScopeSpec();
@@ -1580,7 +1577,7 @@ struct DeclaratorChunk {
     I.EndLoc        = Loc;
     I.Mem.TypeQuals = TypeQuals;
     I.Mem.AttrList  = nullptr;
-    new (I.Mem.ScopeMem.Mem) CXXScopeSpec(SS);
+    new (I.Mem.ScopeMem) CXXScopeSpec(SS);
     return I;
   }
 
index ed1e768832ccecb701f2c3db54641c503155a119..8a64b8bb96265b6360c8203c75469a82710c346d 100644 (file)
@@ -199,10 +199,7 @@ struct DeductionFailureInfo {
   void *Data;
 
   /// \brief A diagnostic indicating why deduction failed.
-  union {
-    void *Align;
-    char Diagnostic[sizeof(PartialDiagnosticAt)];
-  };
+  alignas(PartialDiagnosticAt) char Diagnostic[sizeof(PartialDiagnosticAt)];
 
   /// \brief Retrieve the diagnostic which caused this deduction failure,
   /// if any.