Skip to content

Commit 3a05e76

Browse files
committed
[clang][NFC] Annotate Sema/DeclSpec.h with preferred_type
This helps debuggers to display values in bit-fields in a more helpful way.
1 parent 2a51c56 commit 3a05e76

File tree

1 file changed

+50
-6
lines changed

1 file changed

+50
-6
lines changed

clang/include/clang/Sema/DeclSpec.h

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,36 +353,57 @@ class DeclSpec {
353353

354354
private:
355355
// storage-class-specifier
356-
/*SCS*/unsigned StorageClassSpec : 3;
357-
/*TSCS*/unsigned ThreadStorageClassSpec : 2;
356+
LLVM_PREFERRED_TYPE(SCS)
357+
unsigned StorageClassSpec : 3;
358+
LLVM_PREFERRED_TYPE(TSCS)
359+
unsigned ThreadStorageClassSpec : 2;
360+
LLVM_PREFERRED_TYPE(bool)
358361
unsigned SCS_extern_in_linkage_spec : 1;
359362

360363
// type-specifier
361-
/*TypeSpecifierWidth*/ unsigned TypeSpecWidth : 2;
362-
/*TSC*/unsigned TypeSpecComplex : 2;
363-
/*TSS*/unsigned TypeSpecSign : 2;
364-
/*TST*/unsigned TypeSpecType : 7;
364+
LLVM_PREFERRED_TYPE(TypeSpecifierWidth)
365+
unsigned TypeSpecWidth : 2;
366+
LLVM_PREFERRED_TYPE(TSC)
367+
unsigned TypeSpecComplex : 2;
368+
LLVM_PREFERRED_TYPE(TypeSpecifierSign)
369+
unsigned TypeSpecSign : 2;
370+
LLVM_PREFERRED_TYPE(TST)
371+
unsigned TypeSpecType : 7;
372+
LLVM_PREFERRED_TYPE(bool)
365373
unsigned TypeAltiVecVector : 1;
374+
LLVM_PREFERRED_TYPE(bool)
366375
unsigned TypeAltiVecPixel : 1;
376+
LLVM_PREFERRED_TYPE(bool)
367377
unsigned TypeAltiVecBool : 1;
378+
LLVM_PREFERRED_TYPE(bool)
368379
unsigned TypeSpecOwned : 1;
380+
LLVM_PREFERRED_TYPE(bool)
369381
unsigned TypeSpecPipe : 1;
382+
LLVM_PREFERRED_TYPE(bool)
370383
unsigned TypeSpecSat : 1;
384+
LLVM_PREFERRED_TYPE(bool)
371385
unsigned ConstrainedAuto : 1;
372386

373387
// type-qualifiers
388+
LLVM_PREFERRED_TYPE(TQ)
374389
unsigned TypeQualifiers : 5; // Bitwise OR of TQ.
375390

376391
// function-specifier
392+
LLVM_PREFERRED_TYPE(bool)
377393
unsigned FS_inline_specified : 1;
394+
LLVM_PREFERRED_TYPE(bool)
378395
unsigned FS_forceinline_specified: 1;
396+
LLVM_PREFERRED_TYPE(bool)
379397
unsigned FS_virtual_specified : 1;
398+
LLVM_PREFERRED_TYPE(bool)
380399
unsigned FS_noreturn_specified : 1;
381400

382401
// friend-specifier
402+
LLVM_PREFERRED_TYPE(bool)
383403
unsigned Friend_specified : 1;
384404

385405
// constexpr-specifier
406+
LLVM_PREFERRED_TYPE(ConstexprSpecKind)
386407
unsigned ConstexprSpecifier : 2;
387408

388409
union {
@@ -1246,6 +1267,7 @@ struct DeclaratorChunk {
12461267

12471268
struct PointerTypeInfo {
12481269
/// The type qualifiers: const/volatile/restrict/unaligned/atomic.
1270+
LLVM_PREFERRED_TYPE(DeclSpec::TQ)
12491271
unsigned TypeQuals : 5;
12501272

12511273
/// The location of the const-qualifier, if any.
@@ -1279,12 +1301,15 @@ struct DeclaratorChunk {
12791301
struct ArrayTypeInfo {
12801302
/// The type qualifiers for the array:
12811303
/// const/volatile/restrict/__unaligned/_Atomic.
1304+
LLVM_PREFERRED_TYPE(DeclSpec::TQ)
12821305
unsigned TypeQuals : 5;
12831306

12841307
/// True if this dimension included the 'static' keyword.
1308+
LLVM_PREFERRED_TYPE(bool)
12851309
unsigned hasStatic : 1;
12861310

12871311
/// True if this dimension was [*]. In this case, NumElts is null.
1312+
LLVM_PREFERRED_TYPE(bool)
12881313
unsigned isStar : 1;
12891314

12901315
/// This is the size of the array, or null if [] or [*] was specified.
@@ -1331,28 +1356,35 @@ struct DeclaratorChunk {
13311356
/// hasPrototype - This is true if the function had at least one typed
13321357
/// parameter. If the function is () or (a,b,c), then it has no prototype,
13331358
/// and is treated as a K&R-style function.
1359+
LLVM_PREFERRED_TYPE(bool)
13341360
unsigned hasPrototype : 1;
13351361

13361362
/// isVariadic - If this function has a prototype, and if that
13371363
/// proto ends with ',...)', this is true. When true, EllipsisLoc
13381364
/// contains the location of the ellipsis.
1365+
LLVM_PREFERRED_TYPE(bool)
13391366
unsigned isVariadic : 1;
13401367

13411368
/// Can this declaration be a constructor-style initializer?
1369+
LLVM_PREFERRED_TYPE(bool)
13421370
unsigned isAmbiguous : 1;
13431371

13441372
/// Whether the ref-qualifier (if any) is an lvalue reference.
13451373
/// Otherwise, it's an rvalue reference.
1374+
LLVM_PREFERRED_TYPE(bool)
13461375
unsigned RefQualifierIsLValueRef : 1;
13471376

13481377
/// ExceptionSpecType - An ExceptionSpecificationType value.
1378+
LLVM_PREFERRED_TYPE(ExceptionSpecificationType)
13491379
unsigned ExceptionSpecType : 4;
13501380

13511381
/// DeleteParams - If this is true, we need to delete[] Params.
1382+
LLVM_PREFERRED_TYPE(bool)
13521383
unsigned DeleteParams : 1;
13531384

13541385
/// HasTrailingReturnType - If this is true, a trailing return type was
13551386
/// specified.
1387+
LLVM_PREFERRED_TYPE(bool)
13561388
unsigned HasTrailingReturnType : 1;
13571389

13581390
/// The location of the left parenthesis in the source.
@@ -1567,6 +1599,7 @@ struct DeclaratorChunk {
15671599
struct BlockPointerTypeInfo {
15681600
/// For now, sema will catch these as invalid.
15691601
/// The type qualifiers: const/volatile/restrict/__unaligned/_Atomic.
1602+
LLVM_PREFERRED_TYPE(DeclSpec::TQ)
15701603
unsigned TypeQuals : 5;
15711604

15721605
void destroy() {
@@ -1575,6 +1608,7 @@ struct DeclaratorChunk {
15751608

15761609
struct MemberPointerTypeInfo {
15771610
/// The type qualifiers: const/volatile/restrict/__unaligned/_Atomic.
1611+
LLVM_PREFERRED_TYPE(DeclSpec::TQ)
15781612
unsigned TypeQuals : 5;
15791613
/// Location of the '*' token.
15801614
SourceLocation StarLoc;
@@ -1767,6 +1801,7 @@ class DecompositionDeclarator {
17671801
/// The bindings.
17681802
Binding *Bindings;
17691803
unsigned NumBindings : 31;
1804+
LLVM_PREFERRED_TYPE(bool)
17701805
unsigned DeleteBindings : 1;
17711806

17721807
friend class Declarator;
@@ -1883,33 +1918,42 @@ class Declarator {
18831918
SmallVector<DeclaratorChunk, 8> DeclTypeInfo;
18841919

18851920
/// InvalidType - Set by Sema::GetTypeForDeclarator().
1921+
LLVM_PREFERRED_TYPE(bool)
18861922
unsigned InvalidType : 1;
18871923

18881924
/// GroupingParens - Set by Parser::ParseParenDeclarator().
1925+
LLVM_PREFERRED_TYPE(bool)
18891926
unsigned GroupingParens : 1;
18901927

18911928
/// FunctionDefinition - Is this Declarator for a function or member
18921929
/// definition and, if so, what kind?
18931930
///
18941931
/// Actually a FunctionDefinitionKind.
1932+
LLVM_PREFERRED_TYPE(FunctionDefinitionKind)
18951933
unsigned FunctionDefinition : 2;
18961934

18971935
/// Is this Declarator a redeclaration?
1936+
LLVM_PREFERRED_TYPE(bool)
18981937
unsigned Redeclaration : 1;
18991938

19001939
/// true if the declaration is preceded by \c __extension__.
1940+
LLVM_PREFERRED_TYPE(bool)
19011941
unsigned Extension : 1;
19021942

19031943
/// Indicates whether this is an Objective-C instance variable.
1944+
LLVM_PREFERRED_TYPE(bool)
19041945
unsigned ObjCIvar : 1;
19051946

19061947
/// Indicates whether this is an Objective-C 'weak' property.
1948+
LLVM_PREFERRED_TYPE(bool)
19071949
unsigned ObjCWeakProperty : 1;
19081950

19091951
/// Indicates whether the InlineParams / InlineBindings storage has been used.
1952+
LLVM_PREFERRED_TYPE(bool)
19101953
unsigned InlineStorageUsed : 1;
19111954

19121955
/// Indicates whether this declarator has an initializer.
1956+
LLVM_PREFERRED_TYPE(bool)
19131957
unsigned HasInitializer : 1;
19141958

19151959
/// Attributes attached to the declarator.

0 commit comments

Comments
 (0)