Skip to content

Commit 58679ea

Browse files
committed
[clang][NFC] Annotate clang/Lex headers with preferred_type
This helps debuggers display unsigned bit-fields correctly.
1 parent aa8a0c0 commit 58679ea

File tree

7 files changed

+51
-0
lines changed

7 files changed

+51
-0
lines changed

clang/include/clang/Lex/DirectoryLookup.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,21 @@ class DirectoryLookup {
5050

5151
/// DirCharacteristic - The type of directory this is: this is an instance of
5252
/// SrcMgr::CharacteristicKind.
53+
LLVM_PREFERRED_TYPE(SrcMgr::CharacteristicKind)
5354
unsigned DirCharacteristic : 3;
5455

5556
/// LookupType - This indicates whether this DirectoryLookup object is a
5657
/// normal directory, a framework, or a headermap.
58+
LLVM_PREFERRED_TYPE(LookupType_t)
5759
unsigned LookupType : 2;
5860

5961
/// Whether this is a header map used when building a framework.
62+
LLVM_PREFERRED_TYPE(bool)
6063
unsigned IsIndexHeaderMap : 1;
6164

6265
/// Whether we've performed an exhaustive search for module maps
6366
/// within the subdirectories of this directory.
67+
LLVM_PREFERRED_TYPE(bool)
6468
unsigned SearchedAllModuleMaps : 1;
6569

6670
public:

clang/include/clang/Lex/HeaderSearch.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,36 @@ struct HeaderFileInfo {
5959
// TODO: Whether the file was imported is not a property of the file itself.
6060
// It's a preprocessor state, move it there.
6161
/// True if this is a \#import'd file.
62+
LLVM_PREFERRED_TYPE(bool)
6263
unsigned isImport : 1;
6364

6465
/// True if this is a \#pragma once file.
66+
LLVM_PREFERRED_TYPE(bool)
6567
unsigned isPragmaOnce : 1;
6668

6769
/// Keep track of whether this is a system header, and if so,
6870
/// whether it is C++ clean or not. This can be set by the include paths or
6971
/// by \#pragma gcc system_header. This is an instance of
7072
/// SrcMgr::CharacteristicKind.
73+
LLVM_PREFERRED_TYPE(SrcMgr::CharacteristicKind)
7174
unsigned DirInfo : 3;
7275

7376
/// Whether this header file info was supplied by an external source,
7477
/// and has not changed since.
78+
LLVM_PREFERRED_TYPE(bool)
7579
unsigned External : 1;
7680

7781
/// Whether this header is part of a module.
82+
LLVM_PREFERRED_TYPE(bool)
7883
unsigned isModuleHeader : 1;
7984

8085
/// Whether this header is part of the module that we are building.
86+
LLVM_PREFERRED_TYPE(bool)
8187
unsigned isCompilingModuleHeader : 1;
8288

8389
/// Whether this structure is considered to already have been
8490
/// "resolved", meaning that it was loaded from the external source.
91+
LLVM_PREFERRED_TYPE(bool)
8592
unsigned Resolved : 1;
8693

8794
/// Whether this is a header inside a framework that is currently
@@ -91,9 +98,11 @@ struct HeaderFileInfo {
9198
/// into the appropriate framework subdirectories, and therefore are
9299
/// provided via a header map. This bit indicates when this is one of
93100
/// those framework headers.
101+
LLVM_PREFERRED_TYPE(bool)
94102
unsigned IndexHeaderMapHeader : 1;
95103

96104
/// Whether this file has been looked up as a header.
105+
LLVM_PREFERRED_TYPE(bool)
97106
unsigned IsValid : 1;
98107

99108
/// The ID number of the controlling macro.

clang/include/clang/Lex/HeaderSearchOptions.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,13 @@ class HeaderSearchOptions {
7070
struct Entry {
7171
std::string Path;
7272
frontend::IncludeDirGroup Group;
73+
LLVM_PREFERRED_TYPE(bool)
7374
unsigned IsFramework : 1;
7475

7576
/// IgnoreSysRoot - This is false if an absolute path should be treated
7677
/// relative to the sysroot, or true if it should always be the absolute
7778
/// path.
79+
LLVM_PREFERRED_TYPE(bool)
7880
unsigned IgnoreSysRoot : 1;
7981

8082
Entry(StringRef path, frontend::IncludeDirGroup group, bool isFramework,
@@ -128,10 +130,12 @@ class HeaderSearchOptions {
128130
/// module cache.
129131
///
130132
/// Note: Only used for testing!
133+
LLVM_PREFERRED_TYPE(bool)
131134
unsigned DisableModuleHash : 1;
132135

133136
/// Implicit module maps. This option is enabld by default when
134137
/// modules is enabled.
138+
LLVM_PREFERRED_TYPE(bool)
135139
unsigned ImplicitModuleMaps : 1;
136140

137141
/// Set the 'home directory' of a module map file to the current
@@ -141,16 +145,19 @@ class HeaderSearchOptions {
141145
//
142146
/// The home directory is where we look for files named in the module map
143147
/// file.
148+
LLVM_PREFERRED_TYPE(bool)
144149
unsigned ModuleMapFileHomeIsCwd : 1;
145150

146151
/// Set the base path of a built module file to be the current working
147152
/// directory. This is useful for sharing module files across machines
148153
/// that build with different paths without having to rewrite all
149154
/// modulemap files to have working directory relative paths.
155+
LLVM_PREFERRED_TYPE(bool)
150156
unsigned ModuleFileHomeIsCwd : 1;
151157

152158
/// Also search for prebuilt implicit modules in the prebuilt module cache
153159
/// path.
160+
LLVM_PREFERRED_TYPE(bool)
154161
unsigned EnablePrebuiltImplicitModules : 1;
155162

156163
/// The interval (in seconds) between pruning operations.
@@ -185,55 +192,70 @@ class HeaderSearchOptions {
185192
std::vector<std::string> VFSOverlayFiles;
186193

187194
/// Include the compiler builtin includes.
195+
LLVM_PREFERRED_TYPE(bool)
188196
unsigned UseBuiltinIncludes : 1;
189197

190198
/// Include the system standard include search directories.
199+
LLVM_PREFERRED_TYPE(bool)
191200
unsigned UseStandardSystemIncludes : 1;
192201

193202
/// Include the system standard C++ library include search directories.
203+
LLVM_PREFERRED_TYPE(bool)
194204
unsigned UseStandardCXXIncludes : 1;
195205

196206
/// Use libc++ instead of the default libstdc++.
207+
LLVM_PREFERRED_TYPE(bool)
197208
unsigned UseLibcxx : 1;
198209

199210
/// Whether header search information should be output as for -v.
211+
LLVM_PREFERRED_TYPE(bool)
200212
unsigned Verbose : 1;
201213

202214
/// If true, skip verifying input files used by modules if the
203215
/// module was already verified during this build session (see
204216
/// \c BuildSessionTimestamp).
217+
LLVM_PREFERRED_TYPE(bool)
205218
unsigned ModulesValidateOncePerBuildSession : 1;
206219

207220
/// Whether to validate system input files when a module is loaded.
221+
LLVM_PREFERRED_TYPE(bool)
208222
unsigned ModulesValidateSystemHeaders : 1;
209223

210224
// Whether the content of input files should be hashed and used to
211225
// validate consistency.
226+
LLVM_PREFERRED_TYPE(bool)
212227
unsigned ValidateASTInputFilesContent : 1;
213228

214229
// Whether the input files from C++20 Modules should be checked.
230+
LLVM_PREFERRED_TYPE(bool)
215231
unsigned ForceCheckCXX20ModulesInputFiles : 1;
216232

217233
/// Whether the module includes debug information (-gmodules).
234+
LLVM_PREFERRED_TYPE(bool)
218235
unsigned UseDebugInfo : 1;
219236

237+
LLVM_PREFERRED_TYPE(bool)
220238
unsigned ModulesValidateDiagnosticOptions : 1;
221239

222240
/// Whether to entirely skip writing diagnostic options.
223241
/// Primarily used to speed up deserialization during dependency scanning.
242+
LLVM_PREFERRED_TYPE(bool)
224243
unsigned ModulesSkipDiagnosticOptions : 1;
225244

226245
/// Whether to entirely skip writing header search paths.
227246
/// Primarily used to speed up deserialization during dependency scanning.
247+
LLVM_PREFERRED_TYPE(bool)
228248
unsigned ModulesSkipHeaderSearchPaths : 1;
229249

250+
LLVM_PREFERRED_TYPE(bool)
230251
unsigned ModulesHashContent : 1;
231252

232253
/// Whether we should include all things that could impact the module in the
233254
/// hash.
234255
///
235256
/// This includes things like the full header search path, and enabled
236257
/// diagnostics.
258+
LLVM_PREFERRED_TYPE(bool)
237259
unsigned ModulesStrictContextHash : 1;
238260

239261
HeaderSearchOptions(StringRef _Sysroot = "/")

clang/include/clang/Lex/MacroInfo.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,15 +325,18 @@ class MacroDirective {
325325
SourceLocation Loc;
326326

327327
/// MacroDirective kind.
328+
LLVM_PREFERRED_TYPE(Kind)
328329
unsigned MDKind : 2;
329330

330331
/// True if the macro directive was loaded from a PCH file.
332+
LLVM_PREFERRED_TYPE(bool)
331333
unsigned IsFromPCH : 1;
332334

333335
// Used by VisibilityMacroDirective ----------------------------------------//
334336

335337
/// Whether the macro has public visibility (when described in a
336338
/// module).
339+
LLVM_PREFERRED_TYPE(bool)
337340
unsigned IsPublic : 1;
338341

339342
MacroDirective(Kind K, SourceLocation Loc)

clang/include/clang/Lex/ModuleMap.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,20 @@ class ModuleMap {
232232
/// The set of attributes that can be attached to a module.
233233
struct Attributes {
234234
/// Whether this is a system module.
235+
LLVM_PREFERRED_TYPE(bool)
235236
unsigned IsSystem : 1;
236237

237238
/// Whether this is an extern "C" module.
239+
LLVM_PREFERRED_TYPE(bool)
238240
unsigned IsExternC : 1;
239241

240242
/// Whether this is an exhaustive set of configuration macros.
243+
LLVM_PREFERRED_TYPE(bool)
241244
unsigned IsExhaustive : 1;
242245

243246
/// Whether files in this module can only include non-modular headers
244247
/// and headers from used modules.
248+
LLVM_PREFERRED_TYPE(bool)
245249
unsigned NoUndeclaredIncludes : 1;
246250

247251
Attributes()
@@ -252,6 +256,7 @@ class ModuleMap {
252256
/// A directory for which framework modules can be inferred.
253257
struct InferredDirectory {
254258
/// Whether to infer modules from this directory.
259+
LLVM_PREFERRED_TYPE(bool)
255260
unsigned InferModules : 1;
256261

257262
/// The attributes to use for inferred modules.

clang/include/clang/Lex/PreprocessingRecord.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,18 @@ class Token;
228228

229229
/// Whether the file name was in quotation marks; otherwise, it was
230230
/// in angle brackets.
231+
LLVM_PREFERRED_TYPE(bool)
231232
unsigned InQuotes : 1;
232233

233234
/// The kind of inclusion directive we have.
234235
///
235236
/// This is a value of type InclusionKind.
237+
LLVM_PREFERRED_TYPE(InclusionKind)
236238
unsigned Kind : 2;
237239

238240
/// Whether the inclusion directive was automatically turned into
239241
/// a module import.
242+
LLVM_PREFERRED_TYPE(bool)
240243
unsigned ImportedModule : 1;
241244

242245
/// The file that was included.

clang/include/clang/Lex/VariadicMacroSupport.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,16 @@ namespace clang {
129129
// the function-like macro's new replacement list.
130130
int NumOfTokensPriorToVAOpt = -1;
131131

132+
LLVM_PREFERRED_TYPE(bool)
132133
unsigned LeadingSpaceForStringifiedToken : 1;
133134

135+
LLVM_PREFERRED_TYPE(bool)
134136
unsigned StringifyBefore : 1;
137+
LLVM_PREFERRED_TYPE(bool)
135138
unsigned CharifyBefore : 1;
139+
LLVM_PREFERRED_TYPE(bool)
136140
unsigned BeginsWithPlaceholder : 1;
141+
LLVM_PREFERRED_TYPE(bool)
137142
unsigned EndsWithPlaceholder : 1;
138143

139144
bool hasStringifyBefore() const {

0 commit comments

Comments
 (0)