Author: d0k Date: Thu Oct 20 08:52:26 2016 New Revision: 284729 URL: http://llvm.org/viewvc/llvm-project?rev=284729&view=rev Log: Clean up alignment hacks now that MSVC 2013 and GCC 4.7 are gone.
Modified: cfe/trunk/include/clang/AST/Stmt.h cfe/trunk/include/clang/AST/TemplateBase.h cfe/trunk/include/clang/Sema/DeclSpec.h cfe/trunk/include/clang/Sema/TemplateDeduction.h Modified: cfe/trunk/include/clang/AST/Stmt.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=284729&r1=284728&r2=284729&view=diff ============================================================================== --- cfe/trunk/include/clang/AST/Stmt.h (original) +++ cfe/trunk/include/clang/AST/Stmt.h Thu Oct 20 08:52:26 2016 @@ -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, Modified: cfe/trunk/include/clang/AST/TemplateBase.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateBase.h?rev=284729&r1=284728&r2=284729&view=diff ============================================================================== --- cfe/trunk/include/clang/AST/TemplateBase.h (original) +++ cfe/trunk/include/clang/AST/TemplateBase.h Thu Oct 20 08:52:26 2016 @@ -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; Modified: cfe/trunk/include/clang/Sema/DeclSpec.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=284729&r1=284728&r2=284729&view=diff ============================================================================== --- cfe/trunk/include/clang/Sema/DeclSpec.h (original) +++ cfe/trunk/include/clang/Sema/DeclSpec.h Thu Oct 20 08:52:26 2016 @@ -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; } Modified: cfe/trunk/include/clang/Sema/TemplateDeduction.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/TemplateDeduction.h?rev=284729&r1=284728&r2=284729&view=diff ============================================================================== --- cfe/trunk/include/clang/Sema/TemplateDeduction.h (original) +++ cfe/trunk/include/clang/Sema/TemplateDeduction.h Thu Oct 20 08:52:26 2016 @@ -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. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits