diff --git a/clang/include/clang/Basic/AttributeCommonInfo.h b/clang/include/clang/Basic/AttributeCommonInfo.h index 7dc05418498d0..908e0c7154427 100644 --- a/clang/include/clang/Basic/AttributeCommonInfo.h +++ b/clang/include/clang/Basic/AttributeCommonInfo.h @@ -74,11 +74,16 @@ class AttributeCommonInfo { SourceRange AttrRange; const SourceLocation ScopeLoc; // Corresponds to the Kind enum. + LLVM_PREFERRED_TYPE(Kind) unsigned AttrKind : 16; /// Corresponds to the Syntax enum. + LLVM_PREFERRED_TYPE(Syntax) unsigned SyntaxUsed : 4; + LLVM_PREFERRED_TYPE(bool) unsigned SpellingIndex : 4; + LLVM_PREFERRED_TYPE(bool) unsigned IsAlignas : 1; + LLVM_PREFERRED_TYPE(bool) unsigned IsRegularKeywordAttribute : 1; protected: @@ -123,9 +128,12 @@ class AttributeCommonInfo { : SyntaxUsed(SyntaxUsed), SpellingIndex(SpellingNotCalculated), IsAlignas(0), IsRegularKeywordAttribute(0) {} + LLVM_PREFERRED_TYPE(Syntax) unsigned SyntaxUsed : 4; unsigned SpellingIndex : 4; + LLVM_PREFERRED_TYPE(bool) unsigned IsAlignas : 1; + LLVM_PREFERRED_TYPE(bool) unsigned IsRegularKeywordAttribute : 1; }; diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index 3df037b793b39..0c7836c2ea569 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -314,18 +314,23 @@ class DiagnosticsEngine : public RefCountedBase { // "Global" configuration state that can actually vary between modules. // Ignore all warnings: -w + LLVM_PREFERRED_TYPE(bool) unsigned IgnoreAllWarnings : 1; // Enable all warnings. + LLVM_PREFERRED_TYPE(bool) unsigned EnableAllWarnings : 1; // Treat warnings like errors. + LLVM_PREFERRED_TYPE(bool) unsigned WarningsAsErrors : 1; // Treat errors like fatal errors. + LLVM_PREFERRED_TYPE(bool) unsigned ErrorsAsFatal : 1; // Suppress warnings in system headers. + LLVM_PREFERRED_TYPE(bool) unsigned SuppressSystemWarnings : 1; // Map extensions to warnings or errors? @@ -1822,12 +1827,17 @@ class ForwardingDiagnosticConsumer : public DiagnosticConsumer { struct TemplateDiffTypes { intptr_t FromType; intptr_t ToType; + LLVM_PREFERRED_TYPE(bool) unsigned PrintTree : 1; + LLVM_PREFERRED_TYPE(bool) unsigned PrintFromType : 1; + LLVM_PREFERRED_TYPE(bool) unsigned ElideType : 1; + LLVM_PREFERRED_TYPE(bool) unsigned ShowColors : 1; // The printer sets this variable to true if the template diff was used. + LLVM_PREFERRED_TYPE(bool) unsigned TemplateDiffUsed : 1; }; diff --git a/clang/include/clang/Basic/DiagnosticIDs.h b/clang/include/clang/Basic/DiagnosticIDs.h index 06ef1c6904c31..0cdda42793f6f 100644 --- a/clang/include/clang/Basic/DiagnosticIDs.h +++ b/clang/include/clang/Basic/DiagnosticIDs.h @@ -100,11 +100,17 @@ namespace clang { } class DiagnosticMapping { + LLVM_PREFERRED_TYPE(diag::Severity) unsigned Severity : 3; + LLVM_PREFERRED_TYPE(bool) unsigned IsUser : 1; + LLVM_PREFERRED_TYPE(bool) unsigned IsPragma : 1; + LLVM_PREFERRED_TYPE(bool) unsigned HasNoWarningAsError : 1; + LLVM_PREFERRED_TYPE(bool) unsigned HasNoErrorAsFatal : 1; + LLVM_PREFERRED_TYPE(bool) unsigned WasUpgradedFromWarning : 1; public: diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module.h index 6a7423938bdb8..239eb5a637f3e 100644 --- a/clang/include/clang/Basic/Module.h +++ b/clang/include/clang/Basic/Module.h @@ -298,50 +298,62 @@ class alignas(8) Module { /// Whether this module has declared itself unimportable, either because /// it's missing a requirement from \p Requirements or because it's been /// shadowed by another module. + LLVM_PREFERRED_TYPE(bool) unsigned IsUnimportable : 1; /// Whether we tried and failed to load a module file for this module. + LLVM_PREFERRED_TYPE(bool) unsigned HasIncompatibleModuleFile : 1; /// Whether this module is available in the current translation unit. /// /// If the module is missing headers or does not meet all requirements then /// this bit will be 0. + LLVM_PREFERRED_TYPE(bool) unsigned IsAvailable : 1; /// Whether this module was loaded from a module file. + LLVM_PREFERRED_TYPE(bool) unsigned IsFromModuleFile : 1; /// Whether this is a framework module. + LLVM_PREFERRED_TYPE(bool) unsigned IsFramework : 1; /// Whether this is an explicit submodule. + LLVM_PREFERRED_TYPE(bool) unsigned IsExplicit : 1; /// Whether this is a "system" module (which assumes that all /// headers in it are system headers). + LLVM_PREFERRED_TYPE(bool) unsigned IsSystem : 1; /// Whether this is an 'extern "C"' module (which implicitly puts all /// headers in it within an 'extern "C"' block, and allows the module to be /// imported within such a block). + LLVM_PREFERRED_TYPE(bool) unsigned IsExternC : 1; /// Whether this is an inferred submodule (module * { ... }). + LLVM_PREFERRED_TYPE(bool) unsigned IsInferred : 1; /// Whether we should infer submodules for this module based on /// the headers. /// /// Submodules can only be inferred for modules with an umbrella header. + LLVM_PREFERRED_TYPE(bool) unsigned InferSubmodules : 1; /// Whether, when inferring submodules, the inferred submodules /// should be explicit. + LLVM_PREFERRED_TYPE(bool) unsigned InferExplicitSubmodules : 1; /// Whether, when inferring submodules, the inferr submodules should /// export all modules they import (e.g., the equivalent of "export *"). + LLVM_PREFERRED_TYPE(bool) unsigned InferExportWildcard : 1; /// Whether the set of configuration macros is exhaustive. @@ -349,18 +361,22 @@ class alignas(8) Module { /// When the set of configuration macros is exhaustive, meaning /// that no identifier not in this list should affect how the module is /// built. + LLVM_PREFERRED_TYPE(bool) unsigned ConfigMacrosExhaustive : 1; /// Whether files in this module can only include non-modular headers /// and headers from used modules. + LLVM_PREFERRED_TYPE(bool) unsigned NoUndeclaredIncludes : 1; /// Whether this module came from a "private" module map, found next /// to a regular (public) module map. + LLVM_PREFERRED_TYPE(bool) unsigned ModuleMapIsPrivate : 1; /// Whether this C++20 named modules doesn't need an initializer. /// This is only meaningful for C++20 modules. + LLVM_PREFERRED_TYPE(bool) unsigned NamedModuleHasInit : 1; /// Describes the visibility of the various names within a diff --git a/clang/include/clang/Basic/ParsedAttrInfo.h b/clang/include/clang/Basic/ParsedAttrInfo.h index 3950d484ffd32..537d8f3391d58 100644 --- a/clang/include/clang/Basic/ParsedAttrInfo.h +++ b/clang/include/clang/Basic/ParsedAttrInfo.h @@ -33,6 +33,7 @@ class TargetInfo; struct ParsedAttrInfo { /// Corresponds to the Kind enum. + LLVM_PREFERRED_TYPE(AttributeCommonInfo::Kind) unsigned AttrKind : 16; /// The number of required arguments of this attribute. unsigned NumArgs : 4; @@ -41,18 +42,25 @@ struct ParsedAttrInfo { /// The number of non-fake arguments specified in the attribute definition. unsigned NumArgMembers : 4; /// True if the parsing does not match the semantic content. + LLVM_PREFERRED_TYPE(bool) unsigned HasCustomParsing : 1; // True if this attribute accepts expression parameter pack expansions. + LLVM_PREFERRED_TYPE(bool) unsigned AcceptsExprPack : 1; /// True if this attribute is only available for certain targets. + LLVM_PREFERRED_TYPE(bool) unsigned IsTargetSpecific : 1; /// True if this attribute applies to types. + LLVM_PREFERRED_TYPE(bool) unsigned IsType : 1; /// True if this attribute applies to statements. + LLVM_PREFERRED_TYPE(bool) unsigned IsStmt : 1; /// True if this attribute has any spellings that are known to gcc. + LLVM_PREFERRED_TYPE(bool) unsigned IsKnownToGCC : 1; /// True if this attribute is supported by #pragma clang attribute. + LLVM_PREFERRED_TYPE(bool) unsigned IsSupportedByPragmaAttribute : 1; /// The syntaxes supported by this attribute and how they're spelled. struct Spelling { diff --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h index 420fda111ad13..985ea6354b821 100644 --- a/clang/include/clang/Basic/SourceManager.h +++ b/clang/include/clang/Basic/SourceManager.h @@ -167,17 +167,21 @@ class alignas(8) ContentCache { /// /// When true, the original entry may be a virtual file that does not /// exist. + LLVM_PREFERRED_TYPE(bool) unsigned BufferOverridden : 1; /// True if this content cache was initially created for a source file /// considered to be volatile (likely to change between stat and open). + LLVM_PREFERRED_TYPE(bool) unsigned IsFileVolatile : 1; /// True if this file may be transient, that is, if it might not /// exist at some later point in time when this content entry is used, /// after serialization and deserialization. + LLVM_PREFERRED_TYPE(bool) unsigned IsTransient : 1; + LLVM_PREFERRED_TYPE(bool) mutable unsigned IsBufferInvalid : 1; ContentCache() @@ -305,6 +309,7 @@ class FileInfo { unsigned NumCreatedFIDs : 31; /// Whether this FileInfo has any \#line directives. + LLVM_PREFERRED_TYPE(bool) unsigned HasLineDirectives : 1; /// The content cache and the characteristic of the file. @@ -476,6 +481,7 @@ static_assert(sizeof(FileInfo) <= sizeof(ExpansionInfo), class SLocEntry { static constexpr int OffsetBits = 8 * sizeof(SourceLocation::UIntTy) - 1; SourceLocation::UIntTy Offset : OffsetBits; + LLVM_PREFERRED_TYPE(bool) SourceLocation::UIntTy IsExpansion : 1; union { FileInfo File; diff --git a/clang/include/clang/Basic/Specifiers.h b/clang/include/clang/Basic/Specifiers.h index 0add24d53b21e..87f29c8ae10bd 100644 --- a/clang/include/clang/Basic/Specifiers.h +++ b/clang/include/clang/Basic/Specifiers.h @@ -103,9 +103,13 @@ namespace clang { /// were written in a particular type specifier sequence. struct WrittenBuiltinSpecs { static_assert(TST_error < 1 << 7, "Type bitfield not wide enough for TST"); - /*DeclSpec::TST*/ unsigned Type : 7; - /*DeclSpec::TSS*/ unsigned Sign : 2; - /*TypeSpecifierWidth*/ unsigned Width : 2; + LLVM_PREFERRED_TYPE(TypeSpecifierType) + unsigned Type : 7; + LLVM_PREFERRED_TYPE(TypeSpecifierSign) + unsigned Sign : 2; + LLVM_PREFERRED_TYPE(TypeSpecifierWidth) + unsigned Width : 2; + LLVM_PREFERRED_TYPE(bool) unsigned ModeAttr : 1; }; diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h index b3c5cbfb319f0..41f3c2e403cbe 100644 --- a/clang/include/clang/Basic/TargetInfo.h +++ b/clang/include/clang/Basic/TargetInfo.h @@ -156,6 +156,7 @@ struct TransferrableTargetInfo { /// /// Otherwise, when this flag is not set, the normal built-in boolean type is /// used. + LLVM_PREFERRED_TYPE(bool) unsigned UseSignedCharForObjCBool : 1; /// Control whether the alignment of bit-field types is respected when laying @@ -163,6 +164,7 @@ struct TransferrableTargetInfo { /// used to (a) impact the alignment of the containing structure, and (b) /// ensure that the individual bit-field will not straddle an alignment /// boundary. + LLVM_PREFERRED_TYPE(bool) unsigned UseBitFieldTypeAlignment : 1; /// Whether zero length bitfields (e.g., int : 0;) force alignment of @@ -171,13 +173,16 @@ struct TransferrableTargetInfo { /// If the alignment of the zero length bitfield is greater than the member /// that follows it, `bar', `bar' will be aligned as the type of the /// zero-length bitfield. + LLVM_PREFERRED_TYPE(bool) unsigned UseZeroLengthBitfieldAlignment : 1; /// Whether zero length bitfield alignment is respected if they are the /// leading members. + LLVM_PREFERRED_TYPE(bool) unsigned UseLeadingZeroLengthBitfield : 1; /// Whether explicit bit field alignment attributes are honored. + LLVM_PREFERRED_TYPE(bool) unsigned UseExplicitBitFieldAlignment : 1; /// If non-zero, specifies a fixed alignment value for bitfields that follow @@ -239,20 +244,29 @@ class TargetInfo : public TransferrableTargetInfo, mutable StringRef PlatformName; mutable VersionTuple PlatformMinVersion; + LLVM_PREFERRED_TYPE(bool) unsigned HasAlignMac68kSupport : 1; + LLVM_PREFERRED_TYPE(FloatModeKind) unsigned RealTypeUsesObjCFPRetMask : llvm::BitWidth; + LLVM_PREFERRED_TYPE(bool) unsigned ComplexLongDoubleUsesFP2Ret : 1; + LLVM_PREFERRED_TYPE(bool) unsigned HasBuiltinMSVaList : 1; + LLVM_PREFERRED_TYPE(bool) unsigned IsRenderScriptTarget : 1; + LLVM_PREFERRED_TYPE(bool) unsigned HasAArch64SVETypes : 1; + LLVM_PREFERRED_TYPE(bool) unsigned HasRISCVVTypes : 1; + LLVM_PREFERRED_TYPE(bool) unsigned AllowAMDGPUUnsafeFPAtomics : 1; + LLVM_PREFERRED_TYPE(bool) unsigned ARMCDECoprocMask : 8; unsigned MaxOpenCLWorkGroupSize;