r264582 - Reduce size of DefinitionData from 120 to 96 bytes on Windows.

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 28 07:55:25 PDT 2016


Author: nico
Date: Mon Mar 28 09:55:24 2016
New Revision: 264582

URL: http://llvm.org/viewvc/llvm-project?rev=264582&view=rev
Log:
Reduce size of DefinitionData from 120 to 96 bytes on Windows.

In the Microsoft ABI, only bitfields with identical types get
packed together, so use unsigned consistently instead of a
bool / unsigned mix.

No intended behavior change.

Modified:
    cfe/trunk/include/clang/AST/DeclCXX.h

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=264582&r1=264581&r2=264582&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Mon Mar 28 09:55:24 2016
@@ -301,30 +301,30 @@ class CXXRecordDecl : public RecordDecl
     DefinitionData(CXXRecordDecl *D);
 
     /// \brief True if this class has any user-declared constructors.
-    bool UserDeclaredConstructor : 1;
+    unsigned UserDeclaredConstructor : 1;
 
     /// \brief The user-declared special members which this class has.
     unsigned UserDeclaredSpecialMembers : 6;
 
     /// \brief True when this class is an aggregate.
-    bool Aggregate : 1;
+    unsigned Aggregate : 1;
 
     /// \brief True when this class is a POD-type.
-    bool PlainOldData : 1;
+    unsigned PlainOldData : 1;
 
     /// true when this class is empty for traits purposes,
     /// i.e. has no data members other than 0-width bit-fields, has no
     /// virtual function/base, and doesn't inherit from a non-empty
     /// class. Doesn't take union-ness into account.
-    bool Empty : 1;
+    unsigned Empty : 1;
 
     /// \brief True when this class is polymorphic, i.e., has at
     /// least one virtual member or derives from a polymorphic class.
-    bool Polymorphic : 1;
+    unsigned Polymorphic : 1;
 
     /// \brief True when this class is abstract, i.e., has at least
     /// one pure virtual function, (that can come from a base class).
-    bool Abstract : 1;
+    unsigned Abstract : 1;
 
     /// \brief True when this class has standard layout.
     ///
@@ -340,62 +340,62 @@ class CXXRecordDecl : public RecordDecl
     ///   classes with non-static data members, and
     /// * has no base classes of the same type as the first non-static data
     ///   member.
-    bool IsStandardLayout : 1;
+    unsigned IsStandardLayout : 1;
 
     /// \brief True when there are no non-empty base classes.
     ///
     /// This is a helper bit of state used to implement IsStandardLayout more
     /// efficiently.
-    bool HasNoNonEmptyBases : 1;
+    unsigned HasNoNonEmptyBases : 1;
 
     /// \brief True when there are private non-static data members.
-    bool HasPrivateFields : 1;
+    unsigned HasPrivateFields : 1;
 
     /// \brief True when there are protected non-static data members.
-    bool HasProtectedFields : 1;
+    unsigned HasProtectedFields : 1;
 
     /// \brief True when there are private non-static data members.
-    bool HasPublicFields : 1;
+    unsigned HasPublicFields : 1;
 
     /// \brief True if this class (or any subobject) has mutable fields.
-    bool HasMutableFields : 1;
+    unsigned HasMutableFields : 1;
 
     /// \brief True if this class (or any nested anonymous struct or union)
     /// has variant members.
-    bool HasVariantMembers : 1;
+    unsigned HasVariantMembers : 1;
 
     /// \brief True if there no non-field members declared by the user.
-    bool HasOnlyCMembers : 1;
+    unsigned HasOnlyCMembers : 1;
 
     /// \brief True if any field has an in-class initializer, including those
     /// within anonymous unions or structs.
-    bool HasInClassInitializer : 1;
+    unsigned HasInClassInitializer : 1;
 
     /// \brief True if any field is of reference type, and does not have an
     /// in-class initializer.
     ///
     /// In this case, value-initialization of this class is illegal in C++98
     /// even if the class has a trivial default constructor.
-    bool HasUninitializedReferenceMember : 1;
+    unsigned HasUninitializedReferenceMember : 1;
 
     /// \brief True if any non-mutable field whose type doesn't have a user-
     /// provided default ctor also doesn't have an in-class initializer.
-    bool HasUninitializedFields : 1;
+    unsigned HasUninitializedFields : 1;
 
     /// \brief These flags are \c true if a defaulted corresponding special
     /// member can't be fully analyzed without performing overload resolution.
     /// @{
-    bool NeedOverloadResolutionForMoveConstructor : 1;
-    bool NeedOverloadResolutionForMoveAssignment : 1;
-    bool NeedOverloadResolutionForDestructor : 1;
+    unsigned NeedOverloadResolutionForMoveConstructor : 1;
+    unsigned NeedOverloadResolutionForMoveAssignment : 1;
+    unsigned NeedOverloadResolutionForDestructor : 1;
     /// @}
 
     /// \brief These flags are \c true if an implicit defaulted corresponding
     /// special member would be defined as deleted.
     /// @{
-    bool DefaultedMoveConstructorIsDeleted : 1;
-    bool DefaultedMoveAssignmentIsDeleted : 1;
-    bool DefaultedDestructorIsDeleted : 1;
+    unsigned DefaultedMoveConstructorIsDeleted : 1;
+    unsigned DefaultedMoveAssignmentIsDeleted : 1;
+    unsigned DefaultedDestructorIsDeleted : 1;
     /// @}
 
     /// \brief The trivial special members which this class has, per
@@ -415,37 +415,37 @@ class CXXRecordDecl : public RecordDecl
     unsigned DeclaredNonTrivialSpecialMembers : 6;
 
     /// \brief True when this class has a destructor with no semantic effect.
-    bool HasIrrelevantDestructor : 1;
+    unsigned HasIrrelevantDestructor : 1;
 
     /// \brief True when this class has at least one user-declared constexpr
     /// constructor which is neither the copy nor move constructor.
-    bool HasConstexprNonCopyMoveConstructor : 1;
+    unsigned HasConstexprNonCopyMoveConstructor : 1;
 
     /// \brief True if this class has a (possibly implicit) defaulted default
     /// constructor.
-    bool HasDefaultedDefaultConstructor : 1;
+    unsigned HasDefaultedDefaultConstructor : 1;
 
     /// \brief True if a defaulted default constructor for this class would
     /// be constexpr.
-    bool DefaultedDefaultConstructorIsConstexpr : 1;
+    unsigned DefaultedDefaultConstructorIsConstexpr : 1;
 
     /// \brief True if this class has a constexpr default constructor.
     ///
     /// This is true for either a user-declared constexpr default constructor
     /// or an implicitly declared constexpr default constructor.
-    bool HasConstexprDefaultConstructor : 1;
+    unsigned HasConstexprDefaultConstructor : 1;
 
     /// \brief True when this class contains at least one non-static data
     /// member or base class of non-literal or volatile type.
-    bool HasNonLiteralTypeFieldsOrBases : 1;
+    unsigned HasNonLiteralTypeFieldsOrBases : 1;
 
     /// \brief True when visible conversion functions are already computed
     /// and are available.
-    bool ComputedVisibleConversions : 1;
+    unsigned ComputedVisibleConversions : 1;
 
     /// \brief Whether we have a C++11 user-provided default constructor (not
     /// explicitly deleted or defaulted).
-    bool UserProvidedDefaultConstructor : 1;
+    unsigned UserProvidedDefaultConstructor : 1;
 
     /// \brief The special members which have been declared for this class,
     /// either by the user or implicitly.
@@ -453,25 +453,25 @@ class CXXRecordDecl : public RecordDecl
 
     /// \brief Whether an implicit copy constructor would have a const-qualified
     /// parameter.
-    bool ImplicitCopyConstructorHasConstParam : 1;
+    unsigned ImplicitCopyConstructorHasConstParam : 1;
 
     /// \brief Whether an implicit copy assignment operator would have a
     /// const-qualified parameter.
-    bool ImplicitCopyAssignmentHasConstParam : 1;
+    unsigned ImplicitCopyAssignmentHasConstParam : 1;
 
     /// \brief Whether any declared copy constructor has a const-qualified
     /// parameter.
-    bool HasDeclaredCopyConstructorWithConstParam : 1;
+    unsigned HasDeclaredCopyConstructorWithConstParam : 1;
 
     /// \brief Whether any declared copy assignment operator has either a
     /// const-qualified reference parameter or a non-reference parameter.
-    bool HasDeclaredCopyAssignmentWithConstParam : 1;
+    unsigned HasDeclaredCopyAssignmentWithConstParam : 1;
 
     /// \brief Whether this class describes a C++ lambda.
-    bool IsLambda : 1;
+    unsigned IsLambda : 1;
 
     /// \brief Whether we are currently parsing base specifiers.
-    bool IsParsingBaseSpecifiers : 1;
+    unsigned IsParsingBaseSpecifiers : 1;
 
     /// \brief The number of base class specifiers in Bases.
     unsigned NumBases;




More information about the cfe-commits mailing list