Skip to content

Commit 1a0e743

Browse files
committed
[clang][NFC] Annotate clang/Frontend headers with preferred_type
1 parent 8fb2113 commit 1a0e743

File tree

6 files changed

+65
-7
lines changed

6 files changed

+65
-7
lines changed

clang/include/clang/Frontend/ASTUnit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ class ASTUnit {
355355

356356
/// Bit used by CIndex to mark when a translation unit may be in an
357357
/// inconsistent state, and is not safe to free.
358+
LLVM_PREFERRED_TYPE(bool)
358359
unsigned UnsafeToFree : 1;
359360

360361
/// \brief Enumerator specifying the scope for skipping function bodies.

clang/include/clang/Frontend/DependencyOutputOptions.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,22 @@ enum ExtraDepKind {
3333
/// file generation.
3434
class DependencyOutputOptions {
3535
public:
36+
LLVM_PREFERRED_TYPE(bool)
3637
unsigned IncludeSystemHeaders : 1; ///< Include system header dependencies.
38+
LLVM_PREFERRED_TYPE(bool)
3739
unsigned
3840
CanonicalSystemHeaders : 1; ///< canonicalize system header dependencies.
41+
LLVM_PREFERRED_TYPE(bool)
3942
unsigned ShowHeaderIncludes : 1; ///< Show header inclusions (-H).
43+
LLVM_PREFERRED_TYPE(bool)
4044
unsigned UsePhonyTargets : 1; ///< Include phony targets for each
4145
/// dependency, which can avoid some 'make'
4246
/// problems.
47+
LLVM_PREFERRED_TYPE(bool)
4348
unsigned AddMissingHeaderDeps : 1; ///< Add missing headers to dependency list
49+
LLVM_PREFERRED_TYPE(bool)
4450
unsigned IncludeModuleFiles : 1; ///< Include module file dependencies.
51+
LLVM_PREFERRED_TYPE(bool)
4552
unsigned ShowSkippedHeaderIncludes : 1; ///< With ShowHeaderIncludes, show
4653
/// also includes that were skipped
4754
/// due to the "include guard

clang/include/clang/Frontend/FrontendOptions.h

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,6 @@ enum ActionKind {
147147

148148
/// The kind of a file that we've been handed as an input.
149149
class InputKind {
150-
private:
151-
Language Lang;
152-
unsigned Fmt : 3;
153-
unsigned Preprocessed : 1;
154-
unsigned HeaderUnit : 3;
155-
unsigned IsHeader : 1;
156-
157150
public:
158151
/// The input file format.
159152
enum Format {
@@ -172,6 +165,18 @@ class InputKind {
172165
HeaderUnit_Abs
173166
};
174167

168+
private:
169+
Language Lang;
170+
LLVM_PREFERRED_TYPE(Format)
171+
unsigned Fmt : 3;
172+
LLVM_PREFERRED_TYPE(bool)
173+
unsigned Preprocessed : 1;
174+
LLVM_PREFERRED_TYPE(HeaderUnitKind)
175+
unsigned HeaderUnit : 3;
176+
LLVM_PREFERRED_TYPE(bool)
177+
unsigned IsHeader : 1;
178+
179+
public:
175180
constexpr InputKind(Language L = Language::Unknown, Format F = Source,
176181
bool PP = false, HeaderUnitKind HU = HeaderUnit_None,
177182
bool HD = false)
@@ -266,88 +271,116 @@ class FrontendInputFile {
266271
class FrontendOptions {
267272
public:
268273
/// Disable memory freeing on exit.
274+
LLVM_PREFERRED_TYPE(bool)
269275
unsigned DisableFree : 1;
270276

271277
/// When generating PCH files, instruct the AST writer to create relocatable
272278
/// PCH files.
279+
LLVM_PREFERRED_TYPE(bool)
273280
unsigned RelocatablePCH : 1;
274281

275282
/// Show the -help text.
283+
LLVM_PREFERRED_TYPE(bool)
276284
unsigned ShowHelp : 1;
277285

278286
/// Show frontend performance metrics and statistics.
287+
LLVM_PREFERRED_TYPE(bool)
279288
unsigned ShowStats : 1;
280289

290+
LLVM_PREFERRED_TYPE(bool)
281291
unsigned AppendStats : 1;
282292

283293
/// print the supported cpus for the current target
294+
LLVM_PREFERRED_TYPE(bool)
284295
unsigned PrintSupportedCPUs : 1;
285296

286297
/// Print the supported extensions for the current target.
298+
LLVM_PREFERRED_TYPE(bool)
287299
unsigned PrintSupportedExtensions : 1;
288300

289301
/// Show the -version text.
302+
LLVM_PREFERRED_TYPE(bool)
290303
unsigned ShowVersion : 1;
291304

292305
/// Apply fixes even if there are unfixable errors.
306+
LLVM_PREFERRED_TYPE(bool)
293307
unsigned FixWhatYouCan : 1;
294308

295309
/// Apply fixes only for warnings.
310+
LLVM_PREFERRED_TYPE(bool)
296311
unsigned FixOnlyWarnings : 1;
297312

298313
/// Apply fixes and recompile.
314+
LLVM_PREFERRED_TYPE(bool)
299315
unsigned FixAndRecompile : 1;
300316

301317
/// Apply fixes to temporary files.
318+
LLVM_PREFERRED_TYPE(bool)
302319
unsigned FixToTemporaries : 1;
303320

304321
/// Emit ARC errors even if the migrator can fix them.
322+
LLVM_PREFERRED_TYPE(bool)
305323
unsigned ARCMTMigrateEmitARCErrors : 1;
306324

307325
/// Skip over function bodies to speed up parsing in cases you do not need
308326
/// them (e.g. with code completion).
327+
LLVM_PREFERRED_TYPE(bool)
309328
unsigned SkipFunctionBodies : 1;
310329

311330
/// Whether we can use the global module index if available.
331+
LLVM_PREFERRED_TYPE(bool)
312332
unsigned UseGlobalModuleIndex : 1;
313333

314334
/// Whether we can generate the global module index if needed.
335+
LLVM_PREFERRED_TYPE(bool)
315336
unsigned GenerateGlobalModuleIndex : 1;
316337

317338
/// Whether we include declaration dumps in AST dumps.
339+
LLVM_PREFERRED_TYPE(bool)
318340
unsigned ASTDumpDecls : 1;
319341

320342
/// Whether we deserialize all decls when forming AST dumps.
343+
LLVM_PREFERRED_TYPE(bool)
321344
unsigned ASTDumpAll : 1;
322345

323346
/// Whether we include lookup table dumps in AST dumps.
347+
LLVM_PREFERRED_TYPE(bool)
324348
unsigned ASTDumpLookups : 1;
325349

326350
/// Whether we include declaration type dumps in AST dumps.
351+
LLVM_PREFERRED_TYPE(bool)
327352
unsigned ASTDumpDeclTypes : 1;
328353

329354
/// Whether we are performing an implicit module build.
355+
LLVM_PREFERRED_TYPE(bool)
330356
unsigned BuildingImplicitModule : 1;
331357

332358
/// Whether to use a filesystem lock when building implicit modules.
359+
LLVM_PREFERRED_TYPE(bool)
333360
unsigned BuildingImplicitModuleUsesLock : 1;
334361

335362
/// Whether we should embed all used files into the PCM file.
363+
LLVM_PREFERRED_TYPE(bool)
336364
unsigned ModulesEmbedAllFiles : 1;
337365

338366
/// Whether timestamps should be written to the produced PCH file.
367+
LLVM_PREFERRED_TYPE(bool)
339368
unsigned IncludeTimestamps : 1;
340369

341370
/// Should a temporary file be used during compilation.
371+
LLVM_PREFERRED_TYPE(bool)
342372
unsigned UseTemporary : 1;
343373

344374
/// When using -emit-module, treat the modulemap as a system module.
375+
LLVM_PREFERRED_TYPE(bool)
345376
unsigned IsSystemModule : 1;
346377

347378
/// Output (and read) PCM files regardless of compiler errors.
379+
LLVM_PREFERRED_TYPE(bool)
348380
unsigned AllowPCMWithCompilerErrors : 1;
349381

350382
/// Whether to share the FileManager when building modules.
383+
LLVM_PREFERRED_TYPE(bool)
351384
unsigned ModulesShareFileManager : 1;
352385

353386
CodeCompleteOptions CodeCompleteOpts;

clang/include/clang/Frontend/MigratorOptions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ namespace clang {
1818

1919
class MigratorOptions {
2020
public:
21+
LLVM_PREFERRED_TYPE(bool)
2122
unsigned NoNSAllocReallocError : 1;
23+
LLVM_PREFERRED_TYPE(bool)
2224
unsigned NoFinalizeRemoval : 1;
2325
MigratorOptions() {
2426
NoNSAllocReallocError = 0;

clang/include/clang/Frontend/PreprocessorOutputOptions.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,37 @@
99
#ifndef LLVM_CLANG_FRONTEND_PREPROCESSOROUTPUTOPTIONS_H
1010
#define LLVM_CLANG_FRONTEND_PREPROCESSOROUTPUTOPTIONS_H
1111

12+
#include <llvm/Support/Compiler.h>
13+
1214
namespace clang {
1315

1416
/// PreprocessorOutputOptions - Options for controlling the C preprocessor
1517
/// output (e.g., -E).
1618
class PreprocessorOutputOptions {
1719
public:
20+
LLVM_PREFERRED_TYPE(bool)
1821
unsigned ShowCPP : 1; ///< Print normal preprocessed output.
22+
LLVM_PREFERRED_TYPE(bool)
1923
unsigned ShowComments : 1; ///< Show comments.
24+
LLVM_PREFERRED_TYPE(bool)
2025
unsigned ShowLineMarkers : 1; ///< Show \#line markers.
26+
LLVM_PREFERRED_TYPE(bool)
2127
unsigned UseLineDirectives : 1; ///< Use \#line instead of GCC-style \# N.
28+
LLVM_PREFERRED_TYPE(bool)
2229
unsigned ShowMacroComments : 1; ///< Show comments, even in macros.
30+
LLVM_PREFERRED_TYPE(bool)
2331
unsigned ShowMacros : 1; ///< Print macro definitions.
32+
LLVM_PREFERRED_TYPE(bool)
2433
unsigned ShowIncludeDirectives : 1; ///< Print includes, imports etc. within preprocessed output.
34+
LLVM_PREFERRED_TYPE(bool)
2535
unsigned RewriteIncludes : 1; ///< Preprocess include directives only.
36+
LLVM_PREFERRED_TYPE(bool)
2637
unsigned RewriteImports : 1; ///< Include contents of transitively-imported modules.
38+
LLVM_PREFERRED_TYPE(bool)
2739
unsigned MinimizeWhitespace : 1; ///< Ignore whitespace from input.
40+
LLVM_PREFERRED_TYPE(bool)
2841
unsigned DirectivesOnly : 1; ///< Process directives but do not expand macros.
42+
LLVM_PREFERRED_TYPE(bool)
2943
unsigned KeepSystemIncludes : 1; ///< Do not expand system headers.
3044

3145
public:

clang/include/clang/Frontend/TextDiagnosticPrinter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class TextDiagnosticPrinter : public DiagnosticConsumer {
3434
/// A string to prefix to error messages.
3535
std::string Prefix;
3636

37+
LLVM_PREFERRED_TYPE(bool)
3738
unsigned OwnsOutputStream : 1;
3839

3940
public:

0 commit comments

Comments
 (0)