diff options
author | Reid Kleckner <reid@kleckner.net> | 2015-04-02 18:02:39 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2015-04-02 18:02:39 +0000 |
commit | a5cad0d6a66378a3429cb94d557f192d4223180e (patch) | |
tree | 49c9ccb260a94804b599b4cce71d294f6d12744d /clang/include | |
parent | 2bb5d695f9b07e53842ee236f6a49e49a07cd9aa (diff) | |
download | bcm5719-llvm-a5cad0d6a66378a3429cb94d557f192d4223180e.tar.gz bcm5719-llvm-a5cad0d6a66378a3429cb94d557f192d4223180e.zip |
[AST] Shrink the Stmt hierarchy with LLVM_PTR_SIZE for MSVC 2013
Follow-up to r233921 that removes the 'void *Aligner' Stmt union member
for MSVC 2013.
llvm-svn: 233932
Diffstat (limited to 'clang/include')
-rw-r--r-- | clang/include/clang/AST/Stmt.h | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h index 9a0fa8a8dd6..445cd849fcb 100644 --- a/clang/include/clang/AST/Stmt.h +++ b/clang/include/clang/AST/Stmt.h @@ -101,13 +101,7 @@ namespace clang { /// Stmt - This represents one statement. /// -#if !defined(_MSC_VER) || LLVM_MSC_PREREQ(1900) -class LLVM_ALIGNAS(sizeof(void *)) Stmt { -#else -// Old MSVC has issues to align this. Drop when we retire MSVC 2013. When GCC -// 4.7 is also gone this can be just alignof(void *). -class Stmt { -#endif +class LLVM_ALIGNAS(LLVM_PTR_SIZE) Stmt { public: enum StmtClass { NoStmtClass = 0, @@ -293,11 +287,6 @@ protected: }; union { -#if !(!defined(_MSC_VER) || LLVM_MSC_PREREQ(1900)) - // FIXME: this is wasteful on 64-bit platforms. - void *Aligner; -#endif - StmtBitfields StmtBits; CompoundStmtBitfields CompoundStmtBits; ExprBitfields ExprBits; @@ -802,7 +791,11 @@ class LabelStmt : public Stmt { public: LabelStmt(SourceLocation IL, LabelDecl *D, Stmt *substmt) - : Stmt(LabelStmtClass), IdentLoc(IL), TheDecl(D), SubStmt(substmt) {} + : Stmt(LabelStmtClass), IdentLoc(IL), TheDecl(D), SubStmt(substmt) { + static_assert(sizeof(LabelStmt) == + 2 * sizeof(SourceLocation) + 2 * sizeof(void *), + "LabelStmt too big"); + } // \brief Build an empty label statement. explicit LabelStmt(EmptyShell Empty) : Stmt(LabelStmtClass, Empty) { } @@ -1316,8 +1309,12 @@ public: /// class BreakStmt : public Stmt { SourceLocation BreakLoc; + public: - BreakStmt(SourceLocation BL) : Stmt(BreakStmtClass), BreakLoc(BL) {} + BreakStmt(SourceLocation BL) : Stmt(BreakStmtClass), BreakLoc(BL) { + static_assert(sizeof(BreakStmt) == 2 * sizeof(SourceLocation), + "BreakStmt too large"); + } /// \brief Build an empty break statement. explicit BreakStmt(EmptyShell Empty) : Stmt(BreakStmtClass, Empty) { } |