]> granicus.if.org Git - clang/commitdiff
Use the same underlying type for bitfields
authorDavid Majnemer <david.majnemer@gmail.com>
Fri, 24 Jun 2016 04:05:35 +0000 (04:05 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Fri, 24 Jun 2016 04:05:35 +0000 (04:05 +0000)
MSVC allocates fresh storage for consecutive bitfields with different
underlying types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273646 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Attr.h
include/clang/AST/Decl.h
include/clang/AST/DeclCXX.h
include/clang/AST/Expr.h
include/clang/AST/ExprCXX.h
include/clang/Driver/Driver.h
include/clang/Sema/DeclSpec.h
include/clang/Sema/Overload.h

index 85d30cd55b05045eec7f9174648b635d19562698..a94b161a04bc8b98f0d66df55a510f1238579db9 100644 (file)
@@ -51,11 +51,11 @@ protected:
   /// An index into the spelling list of an
   /// attribute defined in Attr.td file.
   unsigned SpellingListIndex : 4;
-  bool Inherited : 1;
-  bool IsPackExpansion : 1;
-  bool Implicit : 1;
-  bool IsLateParsed : 1;
-  bool DuplicatesAllowed : 1;
+  unsigned Inherited : 1;
+  unsigned IsPackExpansion : 1;
+  unsigned Implicit : 1;
+  unsigned IsLateParsed : 1;
+  unsigned DuplicatesAllowed : 1;
 
   void *operator new(size_t bytes) LLVM_NOEXCEPT {
     llvm_unreachable("Attrs cannot be allocated with regular 'new'.");
index 8229078b505ba058217edbc5902e51e3d6c41113..dbb44dfbc2410ba59ffc581d91e5aafc391ccafe 100644 (file)
@@ -2270,7 +2270,7 @@ public:
 /// represent a member of a struct/union/class.
 class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
   // FIXME: This can be packed into the bitfields in Decl.
-  bool Mutable : 1;
+  unsigned Mutable : 1;
   mutable unsigned CachedFieldIndex : 31;
 
   /// The kinds of value we can store in InitializerOrBitWidth.
@@ -2717,20 +2717,20 @@ private:
   /// IsCompleteDefinition - True if this is a definition ("struct foo
   /// {};"), false if it is a declaration ("struct foo;").  It is not
   /// a definition until the definition has been fully processed.
-  bool IsCompleteDefinition : 1;
+  unsigned IsCompleteDefinition : 1;
 
 protected:
   /// IsBeingDefined - True if this is currently being defined.
-  bool IsBeingDefined : 1;
+  unsigned IsBeingDefined : 1;
 
 private:
   /// IsEmbeddedInDeclarator - True if this tag declaration is
   /// "embedded" (i.e., defined or declared for the very first time)
   /// in the syntax of a declarator.
-  bool IsEmbeddedInDeclarator : 1;
+  unsigned IsEmbeddedInDeclarator : 1;
 
   /// \brief True if this tag is free standing, e.g. "struct foo;".
-  bool IsFreeStanding : 1;
+  unsigned IsFreeStanding : 1;
 
 protected:
   // These are used by (and only defined for) EnumDecl.
@@ -2739,26 +2739,26 @@ protected:
 
   /// IsScoped - True if this tag declaration is a scoped enumeration. Only
   /// possible in C++11 mode.
-  bool IsScoped : 1;
+  unsigned IsScoped : 1;
   /// IsScopedUsingClassTag - If this tag declaration is a scoped enum,
   /// then this is true if the scoped enum was declared using the class
   /// tag, false if it was declared with the struct tag. No meaning is
   /// associated if this tag declaration is not a scoped enum.
-  bool IsScopedUsingClassTag : 1;
+  unsigned IsScopedUsingClassTag : 1;
 
   /// IsFixed - True if this is an enumeration with fixed underlying type. Only
   /// possible in C++11, Microsoft extensions, or Objective C mode.
-  bool IsFixed : 1;
+  unsigned IsFixed : 1;
 
   /// \brief Indicates whether it is possible for declarations of this kind
   /// to have an out-of-date definition.
   ///
   /// This option is only enabled when modules are enabled.
-  bool MayHaveOutOfDateDef : 1;
+  unsigned MayHaveOutOfDateDef : 1;
 
   /// Has the full definition of this type been required by a use somewhere in
   /// the TU.
-  bool IsCompleteDefinitionRequired : 1;
+  unsigned IsCompleteDefinitionRequired : 1;
 private:
   SourceLocation RBraceLoc;
 
index 755542c04a170732569a4483e1a6901e17e7307b..9c860f40e1b0128d867f55d457bc591f28036e84 100644 (file)
@@ -165,13 +165,13 @@ class CXXBaseSpecifier {
   SourceLocation EllipsisLoc;
 
   /// \brief Whether this is a virtual base class or not.
-  bool Virtual : 1;
+  unsigned Virtual : 1;
 
   /// \brief Whether this is the base of a class (true) or of a struct (false).
   ///
   /// This determines the mapping from the access specifier as written in the
   /// source code to the access specifier used for semantic analysis.
-  bool BaseOfClass : 1;
+  unsigned BaseOfClass : 1;
 
   /// \brief Access specifier as written in the source code (may be AS_none).
   ///
@@ -181,7 +181,7 @@ class CXXBaseSpecifier {
 
   /// \brief Whether the class contains a using declaration
   /// to inherit the named class's constructors.
-  bool InheritConstructors : 1;
+  unsigned InheritConstructors : 1;
 
   /// \brief The type of the base class.
   ///
@@ -1943,15 +1943,15 @@ class CXXCtorInitializer final
 
   /// \brief If the initializee is a type, whether that type makes this
   /// a delegating initialization.
-  bool IsDelegating : 1;
+  unsigned IsDelegating : 1;
 
   /// \brief If the initializer is a base initializer, this keeps track
   /// of whether the base is virtual or not.
-  bool IsVirtual : 1;
+  unsigned IsVirtual : 1;
 
   /// \brief Whether or not the initializer is explicitly written
   /// in the sources.
-  bool IsWritten : 1;
+  unsigned IsWritten : 1;
 
   /// If IsWritten is true, then this number keeps track of the textual order
   /// of this initializer in the original sources, counting from 0; otherwise,
index 5d050b0ec65fd0313c8720cf81f8c7db0616ab84..ac77484dfe3625b9c0e9efc92077f74702bbb098 100644 (file)
@@ -3956,7 +3956,7 @@ private:
 
   /// Whether this designated initializer used the GNU deprecated
   /// syntax rather than the C99 '=' syntax.
-  bool GNUSyntax : 1;
+  unsigned GNUSyntax : 1;
 
   /// The number of designators in this initializer expression.
   unsigned NumDesignators : 15;
index 54939024d0d0a2fb1b7b162c5c28eb845f56d0f6..1f0536472b0126fb5cdab9c58a0c4e091de0b1f0 100644 (file)
@@ -1758,12 +1758,12 @@ class CXXNewExpr : public Expr {
   SourceRange DirectInitRange;
 
   /// Was the usage ::new, i.e. is the global new to be used?
-  bool GlobalNew : 1;
+  unsigned GlobalNew : 1;
   /// Do we allocate an array? If so, the first SubExpr is the size expression.
-  bool Array : 1;
+  unsigned Array : 1;
   /// If this is an array allocation, does the usual deallocation
   /// function for the allocated type want to know the allocated size?
-  bool UsualArrayDeleteWantsSize : 1;
+  unsigned UsualArrayDeleteWantsSize : 1;
   /// The number of placement new arguments.
   unsigned NumPlacementArgs : 13;
   /// What kind of initializer do we have? Could be none, parens, or braces.
@@ -2362,7 +2362,7 @@ class ExpressionTraitExpr : public Expr {
   /// \brief The trait. A ExpressionTrait enum in MSVC compatible unsigned.
   unsigned ET : 31;
   /// \brief The value of the type trait. Unspecified if dependent.
-  bool Value : 1;
+  unsigned Value : 1;
 
   /// \brief The location of the type trait keyword.
   SourceLocation Loc;
index e344d6feae24fc586684c353ab1b1fe05a13dda4..46bf06d821940b65b763e4fd09d1b5254e3d2acf 100644 (file)
@@ -196,7 +196,7 @@ public:
 
 private:
   /// Certain options suppress the 'no input files' warning.
-  bool SuppressMissingInputWarning : 1;
+  unsigned SuppressMissingInputWarning : 1;
 
   std::list<std::string> TempFiles;
   std::list<std::string> ResultFiles;
index 1f04c996a147844a89ab306a311cbe1dd393cfd9..c71419f28108af4cbbf9a51821c9a2a1dafe90ac 100644 (file)
@@ -1155,10 +1155,10 @@ struct DeclaratorChunk {
     unsigned TypeQuals : 5;
 
     /// True if this dimension included the 'static' keyword.
-    bool hasStatic : 1;
+    unsigned hasStatic : 1;
 
     /// True if this dimension was [*].  In this case, NumElts is null.
-    bool isStar : 1;
+    unsigned isStar : 1;
 
     /// This is the size of the array, or null if [] or [*] was specified.
     /// Since the parser is multi-purpose, and we don't want to impose a root
@@ -1663,10 +1663,10 @@ private:
   SmallVector<DeclaratorChunk, 8> DeclTypeInfo;
 
   /// InvalidType - Set by Sema::GetTypeForDeclarator().
-  bool InvalidType : 1;
+  unsigned InvalidType : 1;
 
   /// GroupingParens - Set by Parser::ParseParenDeclarator().
-  bool GroupingParens : 1;
+  unsigned GroupingParens : 1;
 
   /// FunctionDefinition - Is this Declarator for a function or member 
   /// definition and, if so, what kind?
@@ -1675,7 +1675,7 @@ private:
   unsigned FunctionDefinition : 2;
 
   /// \brief Is this Declarator a redeclaration?
-  bool Redeclaration : 1;
+  unsigned Redeclaration : 1;
 
   /// Attrs - Attributes.
   ParsedAttributes Attrs;
index abc1a07840cca35eea6ccb2b07088f3f3545e131..d0c4db31200c5fb30e977e91fc19f494a8161230 100644 (file)
@@ -397,7 +397,7 @@ namespace clang {
 
     /// \brief Whether the target is really a std::initializer_list, and the
     /// sequence only represents the worst element conversion.
-    bool StdInitializerListElement : 1;
+    unsigned StdInitializerListElement : 1;
 
     void setKind(Kind K) {
       destruct();