Use the same underlying type for bitfields

MSVC allocates fresh storage for consecutive bitfields with different
underlying types.

llvm-svn: 273646
This commit is contained in:
David Majnemer 2016-06-24 04:05:35 +00:00
parent df68f032ae
commit f440d267e3
8 changed files with 33 additions and 33 deletions

View 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'.");

View 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;

View 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,

View 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;

View 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;

View 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;

View 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;

View 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();