Author: Nathan James Date: 2021-02-22T15:25:33Z New Revision: daeb70be0bd42fbed66c03b4c5f9940ffba88ce9
URL: https://github.com/llvm/llvm-project/commit/daeb70be0bd42fbed66c03b4c5f9940ffba88ce9 DIFF: https://github.com/llvm/llvm-project/commit/daeb70be0bd42fbed66c03b4c5f9940ffba88ce9.diff LOG: [clang][NFC] Reorder CXXCtorInitializer members Swapping the order of Init and MemberOrEllipsisLocation removes 8 bytes (20%) of padding on 64bit builds. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D97191 Added: Modified: clang/include/clang/AST/DeclCXX.h clang/lib/AST/DeclCXX.cpp Removed: ################################################################################ diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index 89006b1cfa7f..bb99ab1373ba 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -2166,6 +2166,10 @@ class CXXCtorInitializer final { llvm::PointerUnion<TypeSourceInfo *, FieldDecl *, IndirectFieldDecl *> Initializee; + /// The argument used to initialize the base or member, which may + /// end up constructing an object (when multiple arguments are involved). + Stmt *Init; + /// The source location for the field name or, for a base initializer /// pack expansion, the location of the ellipsis. /// @@ -2174,10 +2178,6 @@ class CXXCtorInitializer final { /// Initializee points to the CXXConstructorDecl (to allow loop detection). SourceLocation MemberOrEllipsisLocation; - /// The argument used to initialize the base or member, which may - /// end up constructing an object (when multiple arguments are involved). - Stmt *Init; - /// Location of the left paren of the ctor-initializer. SourceLocation LParenLoc; diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index 0375f9b4432e..f22e599225b6 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -2506,16 +2506,15 @@ CXXCtorInitializer::CXXCtorInitializer(ASTContext &Context, SourceLocation L, Expr *Init, SourceLocation R, SourceLocation EllipsisLoc) - : Initializee(TInfo), MemberOrEllipsisLocation(EllipsisLoc), Init(Init), + : Initializee(TInfo), Init(Init), MemberOrEllipsisLocation(EllipsisLoc), LParenLoc(L), RParenLoc(R), IsDelegating(false), IsVirtual(IsVirtual), IsWritten(false), SourceOrder(0) {} -CXXCtorInitializer::CXXCtorInitializer(ASTContext &Context, - FieldDecl *Member, +CXXCtorInitializer::CXXCtorInitializer(ASTContext &Context, FieldDecl *Member, SourceLocation MemberLoc, SourceLocation L, Expr *Init, SourceLocation R) - : Initializee(Member), MemberOrEllipsisLocation(MemberLoc), Init(Init), + : Initializee(Member), Init(Init), MemberOrEllipsisLocation(MemberLoc), LParenLoc(L), RParenLoc(R), IsDelegating(false), IsVirtual(false), IsWritten(false), SourceOrder(0) {} @@ -2524,7 +2523,7 @@ CXXCtorInitializer::CXXCtorInitializer(ASTContext &Context, SourceLocation MemberLoc, SourceLocation L, Expr *Init, SourceLocation R) - : Initializee(Member), MemberOrEllipsisLocation(MemberLoc), Init(Init), + : Initializee(Member), Init(Init), MemberOrEllipsisLocation(MemberLoc), LParenLoc(L), RParenLoc(R), IsDelegating(false), IsVirtual(false), IsWritten(false), SourceOrder(0) {} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits