[clang] 1a0e743 - [clang][NFC] Annotate `clang/Frontend` headers with `preferred_type`
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 6 02:38:18 PST 2023
Author: Vlad Serebrennikov
Date: 2023-11-06T13:38:12+03:00
New Revision: 1a0e743ab01716ecafeb33858d9975cf90017c59
URL: https://github.com/llvm/llvm-project/commit/1a0e743ab01716ecafeb33858d9975cf90017c59
DIFF: https://github.com/llvm/llvm-project/commit/1a0e743ab01716ecafeb33858d9975cf90017c59.diff
LOG: [clang][NFC] Annotate `clang/Frontend` headers with `preferred_type`
Added:
Modified:
clang/include/clang/Frontend/ASTUnit.h
clang/include/clang/Frontend/DependencyOutputOptions.h
clang/include/clang/Frontend/FrontendOptions.h
clang/include/clang/Frontend/MigratorOptions.h
clang/include/clang/Frontend/PreprocessorOutputOptions.h
clang/include/clang/Frontend/TextDiagnosticPrinter.h
Removed:
################################################################################
diff --git a/clang/include/clang/Frontend/ASTUnit.h b/clang/include/clang/Frontend/ASTUnit.h
index c6d0d4d7e90233e..bcb28634a2b8841 100644
--- a/clang/include/clang/Frontend/ASTUnit.h
+++ b/clang/include/clang/Frontend/ASTUnit.h
@@ -355,6 +355,7 @@ class ASTUnit {
/// Bit used by CIndex to mark when a translation unit may be in an
/// inconsistent state, and is not safe to free.
+ LLVM_PREFERRED_TYPE(bool)
unsigned UnsafeToFree : 1;
/// \brief Enumerator specifying the scope for skipping function bodies.
diff --git a/clang/include/clang/Frontend/DependencyOutputOptions.h b/clang/include/clang/Frontend/DependencyOutputOptions.h
index e4b26d92647d0a7..558d8a0a0ab693b 100644
--- a/clang/include/clang/Frontend/DependencyOutputOptions.h
+++ b/clang/include/clang/Frontend/DependencyOutputOptions.h
@@ -33,15 +33,22 @@ enum ExtraDepKind {
/// file generation.
class DependencyOutputOptions {
public:
+ LLVM_PREFERRED_TYPE(bool)
unsigned IncludeSystemHeaders : 1; ///< Include system header dependencies.
+ LLVM_PREFERRED_TYPE(bool)
unsigned
CanonicalSystemHeaders : 1; ///< canonicalize system header dependencies.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ShowHeaderIncludes : 1; ///< Show header inclusions (-H).
+ LLVM_PREFERRED_TYPE(bool)
unsigned UsePhonyTargets : 1; ///< Include phony targets for each
/// dependency, which can avoid some 'make'
/// problems.
+ LLVM_PREFERRED_TYPE(bool)
unsigned AddMissingHeaderDeps : 1; ///< Add missing headers to dependency list
+ LLVM_PREFERRED_TYPE(bool)
unsigned IncludeModuleFiles : 1; ///< Include module file dependencies.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ShowSkippedHeaderIncludes : 1; ///< With ShowHeaderIncludes, show
/// also includes that were skipped
/// due to the "include guard
diff --git a/clang/include/clang/Frontend/FrontendOptions.h b/clang/include/clang/Frontend/FrontendOptions.h
index 117e35de6f76c4c..53a8681cfdbba04 100644
--- a/clang/include/clang/Frontend/FrontendOptions.h
+++ b/clang/include/clang/Frontend/FrontendOptions.h
@@ -147,13 +147,6 @@ enum ActionKind {
/// The kind of a file that we've been handed as an input.
class InputKind {
-private:
- Language Lang;
- unsigned Fmt : 3;
- unsigned Preprocessed : 1;
- unsigned HeaderUnit : 3;
- unsigned IsHeader : 1;
-
public:
/// The input file format.
enum Format {
@@ -172,6 +165,18 @@ class InputKind {
HeaderUnit_Abs
};
+private:
+ Language Lang;
+ LLVM_PREFERRED_TYPE(Format)
+ unsigned Fmt : 3;
+ LLVM_PREFERRED_TYPE(bool)
+ unsigned Preprocessed : 1;
+ LLVM_PREFERRED_TYPE(HeaderUnitKind)
+ unsigned HeaderUnit : 3;
+ LLVM_PREFERRED_TYPE(bool)
+ unsigned IsHeader : 1;
+
+public:
constexpr InputKind(Language L = Language::Unknown, Format F = Source,
bool PP = false, HeaderUnitKind HU = HeaderUnit_None,
bool HD = false)
@@ -266,88 +271,116 @@ class FrontendInputFile {
class FrontendOptions {
public:
/// Disable memory freeing on exit.
+ LLVM_PREFERRED_TYPE(bool)
unsigned DisableFree : 1;
/// When generating PCH files, instruct the AST writer to create relocatable
/// PCH files.
+ LLVM_PREFERRED_TYPE(bool)
unsigned RelocatablePCH : 1;
/// Show the -help text.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ShowHelp : 1;
/// Show frontend performance metrics and statistics.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ShowStats : 1;
+ LLVM_PREFERRED_TYPE(bool)
unsigned AppendStats : 1;
/// print the supported cpus for the current target
+ LLVM_PREFERRED_TYPE(bool)
unsigned PrintSupportedCPUs : 1;
/// Print the supported extensions for the current target.
+ LLVM_PREFERRED_TYPE(bool)
unsigned PrintSupportedExtensions : 1;
/// Show the -version text.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ShowVersion : 1;
/// Apply fixes even if there are unfixable errors.
+ LLVM_PREFERRED_TYPE(bool)
unsigned FixWhatYouCan : 1;
/// Apply fixes only for warnings.
+ LLVM_PREFERRED_TYPE(bool)
unsigned FixOnlyWarnings : 1;
/// Apply fixes and recompile.
+ LLVM_PREFERRED_TYPE(bool)
unsigned FixAndRecompile : 1;
/// Apply fixes to temporary files.
+ LLVM_PREFERRED_TYPE(bool)
unsigned FixToTemporaries : 1;
/// Emit ARC errors even if the migrator can fix them.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ARCMTMigrateEmitARCErrors : 1;
/// Skip over function bodies to speed up parsing in cases you do not need
/// them (e.g. with code completion).
+ LLVM_PREFERRED_TYPE(bool)
unsigned SkipFunctionBodies : 1;
/// Whether we can use the global module index if available.
+ LLVM_PREFERRED_TYPE(bool)
unsigned UseGlobalModuleIndex : 1;
/// Whether we can generate the global module index if needed.
+ LLVM_PREFERRED_TYPE(bool)
unsigned GenerateGlobalModuleIndex : 1;
/// Whether we include declaration dumps in AST dumps.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ASTDumpDecls : 1;
/// Whether we deserialize all decls when forming AST dumps.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ASTDumpAll : 1;
/// Whether we include lookup table dumps in AST dumps.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ASTDumpLookups : 1;
/// Whether we include declaration type dumps in AST dumps.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ASTDumpDeclTypes : 1;
/// Whether we are performing an implicit module build.
+ LLVM_PREFERRED_TYPE(bool)
unsigned BuildingImplicitModule : 1;
/// Whether to use a filesystem lock when building implicit modules.
+ LLVM_PREFERRED_TYPE(bool)
unsigned BuildingImplicitModuleUsesLock : 1;
/// Whether we should embed all used files into the PCM file.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ModulesEmbedAllFiles : 1;
/// Whether timestamps should be written to the produced PCH file.
+ LLVM_PREFERRED_TYPE(bool)
unsigned IncludeTimestamps : 1;
/// Should a temporary file be used during compilation.
+ LLVM_PREFERRED_TYPE(bool)
unsigned UseTemporary : 1;
/// When using -emit-module, treat the modulemap as a system module.
+ LLVM_PREFERRED_TYPE(bool)
unsigned IsSystemModule : 1;
/// Output (and read) PCM files regardless of compiler errors.
+ LLVM_PREFERRED_TYPE(bool)
unsigned AllowPCMWithCompilerErrors : 1;
/// Whether to share the FileManager when building modules.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ModulesShareFileManager : 1;
CodeCompleteOptions CodeCompleteOpts;
diff --git a/clang/include/clang/Frontend/MigratorOptions.h b/clang/include/clang/Frontend/MigratorOptions.h
index cf50ffcf0c4f5ad..42181c585669391 100644
--- a/clang/include/clang/Frontend/MigratorOptions.h
+++ b/clang/include/clang/Frontend/MigratorOptions.h
@@ -18,7 +18,9 @@ namespace clang {
class MigratorOptions {
public:
+ LLVM_PREFERRED_TYPE(bool)
unsigned NoNSAllocReallocError : 1;
+ LLVM_PREFERRED_TYPE(bool)
unsigned NoFinalizeRemoval : 1;
MigratorOptions() {
NoNSAllocReallocError = 0;
diff --git a/clang/include/clang/Frontend/PreprocessorOutputOptions.h b/clang/include/clang/Frontend/PreprocessorOutputOptions.h
index db2ec9f2ae20698..6e19cae33cf283d 100644
--- a/clang/include/clang/Frontend/PreprocessorOutputOptions.h
+++ b/clang/include/clang/Frontend/PreprocessorOutputOptions.h
@@ -9,23 +9,37 @@
#ifndef LLVM_CLANG_FRONTEND_PREPROCESSOROUTPUTOPTIONS_H
#define LLVM_CLANG_FRONTEND_PREPROCESSOROUTPUTOPTIONS_H
+#include <llvm/Support/Compiler.h>
+
namespace clang {
/// PreprocessorOutputOptions - Options for controlling the C preprocessor
/// output (e.g., -E).
class PreprocessorOutputOptions {
public:
+ LLVM_PREFERRED_TYPE(bool)
unsigned ShowCPP : 1; ///< Print normal preprocessed output.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ShowComments : 1; ///< Show comments.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ShowLineMarkers : 1; ///< Show \#line markers.
+ LLVM_PREFERRED_TYPE(bool)
unsigned UseLineDirectives : 1; ///< Use \#line instead of GCC-style \# N.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ShowMacroComments : 1; ///< Show comments, even in macros.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ShowMacros : 1; ///< Print macro definitions.
+ LLVM_PREFERRED_TYPE(bool)
unsigned ShowIncludeDirectives : 1; ///< Print includes, imports etc. within preprocessed output.
+ LLVM_PREFERRED_TYPE(bool)
unsigned RewriteIncludes : 1; ///< Preprocess include directives only.
+ LLVM_PREFERRED_TYPE(bool)
unsigned RewriteImports : 1; ///< Include contents of transitively-imported modules.
+ LLVM_PREFERRED_TYPE(bool)
unsigned MinimizeWhitespace : 1; ///< Ignore whitespace from input.
+ LLVM_PREFERRED_TYPE(bool)
unsigned DirectivesOnly : 1; ///< Process directives but do not expand macros.
+ LLVM_PREFERRED_TYPE(bool)
unsigned KeepSystemIncludes : 1; ///< Do not expand system headers.
public:
diff --git a/clang/include/clang/Frontend/TextDiagnosticPrinter.h b/clang/include/clang/Frontend/TextDiagnosticPrinter.h
index ba756fa18c301b6..2610bde7513a1a0 100644
--- a/clang/include/clang/Frontend/TextDiagnosticPrinter.h
+++ b/clang/include/clang/Frontend/TextDiagnosticPrinter.h
@@ -34,6 +34,7 @@ class TextDiagnosticPrinter : public DiagnosticConsumer {
/// A string to prefix to error messages.
std::string Prefix;
+ LLVM_PREFERRED_TYPE(bool)
unsigned OwnsOutputStream : 1;
public:
More information about the cfe-commits
mailing list