|
clang 23.0.0git
|
PreprocessorOptions - This class is used for passing the various options used in preprocessor initialization to InitializePreprocessor(). More...
#include "clang/Lex/PreprocessorOptions.h"
Public Member Functions | |
| PreprocessorOptions () | |
| void | addMacroDef (StringRef Name) |
| void | addMacroUndef (StringRef Name) |
| void | addRemappedFile (StringRef From, StringRef To) |
| void | addRemappedFile (StringRef From, llvm::MemoryBuffer *To) |
| void | clearRemappedFiles () |
| void | resetNonModularOptions () |
| Reset any options that are not considered when building a module. | |
Public Attributes | |
| std::vector< std::pair< std::string, bool > > | Macros |
| std::vector< std::string > | Includes |
| std::vector< std::string > | MacroIncludes |
| bool | ModulesCheckRelocated = true |
| Perform extra checks when loading PCM files for mutable file systems. | |
| bool | UsePredefines = true |
| Initialize the preprocessor with the compiler and target specific predefines. | |
| bool | DefineTargetOSMacros = false |
| Indicates whether to predefine target OS macros. | |
| bool | DetailedRecord = false |
| Whether we should maintain a detailed record of all macro definitions and expansions. | |
| bool | PCHWithHdrStop = false |
| When true, we are creating or using a PCH where a #pragma hdrstop is expected to indicate the beginning or end of the PCH. | |
| bool | PCHWithHdrStopCreate = false |
| When true, we are creating a PCH or creating the PCH object while expecting a #pragma hdrstop to separate the two. | |
| std::string | PCHThroughHeader |
| If non-empty, the filename used in an #include directive in the primary source file (or command-line preinclude) that is used to implement MSVC-style precompiled headers. | |
| std::string | ImplicitPCHInclude |
| The implicit PCH included at the start of the translation unit, or empty. | |
| std::vector< std::string > | ChainedIncludes |
| Headers that will be converted to chained PCHs in memory. | |
| DisableValidationForModuleKind | DisablePCHOrModuleValidation |
| Whether to disable most of the normal validation performed on precompiled headers and module files. | |
| bool | AllowPCHWithCompilerErrors = false |
| When true, a PCH with compiler errors will not be rejected. | |
| bool | AllowPCHWithDifferentModulesCachePath = false |
| When true, a PCH with modules cache path different to the current compilation will not be rejected. | |
| bool | DumpDeserializedPCHDecls = false |
| Dump declarations that are deserialized from PCH, for testing. | |
| std::set< std::string > | DeserializedPCHDeclsToErrorOn |
| This is a set of names for decls that we do not want to be deserialized, and we emit an error if they are; for testing purposes. | |
| std::pair< unsigned, bool > | PrecompiledPreambleBytes |
| If non-zero, the implicit PCH include is actually a precompiled preamble that covers this number of bytes in the main source file. | |
| bool | GeneratePreamble = false |
| True indicates that a preamble is being generated. | |
| bool | WriteCommentListToPCH = true |
| Whether to write comment locations into the PCH when building it. | |
| bool | SingleFileParseMode = false |
| When enabled, preprocessor is in a mode for parsing a single file only. | |
| bool | SingleModuleParseMode = false |
| When enabled, preprocessor is in a mode for parsing a single module only. | |
| bool | LexEditorPlaceholders = true |
| When enabled, the preprocessor will construct editor placeholder tokens. | |
| bool | RemappedFilesKeepOriginalName = true |
| True if the SourceManager should report the original file name for contents of files that were remapped to other files. | |
| std::vector< std::pair< std::string, std::string > > | RemappedFiles |
| The set of file remappings, which take existing files on the system (the first part of each pair) and gives them the contents of other files on the system (the second part of each pair). | |
| std::vector< std::pair< std::string, llvm::MemoryBuffer * > > | RemappedFileBuffers |
| The set of file-to-buffer remappings, which take existing files on the system (the first part of each pair) and gives them the contents of the specified memory buffer (the second part of each pair). | |
| std::vector< std::string > | EmbedEntries |
| User specified embed entries. | |
| bool | RetainRemappedFileBuffers = false |
| Whether the compiler instance should retain (i.e., not free) the buffers associated with remapped files. | |
| bool | RetainExcludedConditionalBlocks = false |
| When enabled, excluded conditional blocks retain in the main file. | |
| ObjCXXARCStandardLibraryKind | ObjCXXARCStandardLibrary = ARCXX_nolib |
| The Objective-C++ ARC standard library that we should support, by providing appropriate definitions to retrofit the standard library with support for lifetime-qualified pointers. | |
| bool | SetUpStaticAnalyzer = false |
| Set up preprocessor for RunAnalysis action. | |
| bool | DisablePragmaDebugCrash = false |
| Prevents intended crashes when using #pragma clang __debug. For testing. | |
| std::optional< uint64_t > | SourceDateEpoch |
| If set, the UNIX timestamp specified by SOURCE_DATE_EPOCH. | |
| uint32_t | InitialCounterValue = 0 |
| The initial value for COUNTER; typically is zero but can be set via a -cc1 flag for testing purposes. | |
| DateTimeInitKind | InitDateTimeMacros = DateTimeInitKind::Default |
| Specify initialization kind for DATE, TIME and TIMESTAMP macros. | |
PreprocessorOptions - This class is used for passing the various options used in preprocessor initialization to InitializePreprocessor().
Definition at line 78 of file PreprocessorOptions.h.
|
inline |
Definition at line 229 of file PreprocessorOptions.h.
References false, and PrecompiledPreambleBytes.
|
inline |
Definition at line 231 of file PreprocessorOptions.h.
References Macros.
Referenced by ParsePreprocessorArgs().
|
inline |
Definition at line 234 of file PreprocessorOptions.h.
References Macros.
Referenced by ParsePreprocessorArgs().
|
inline |
Definition at line 242 of file PreprocessorOptions.h.
References RemappedFileBuffers.
|
inline |
Definition at line 238 of file PreprocessorOptions.h.
References RemappedFiles.
Referenced by clang::PrecompiledPreamble::Build(), clang::ASTUnit::CodeComplete(), and ParsePreprocessorArgs().
|
inline |
Definition at line 246 of file PreprocessorOptions.h.
References RemappedFileBuffers, and RemappedFiles.
Referenced by clang::ASTUnit::CodeComplete(), and clang::ASTUnit::Reparse().
|
inline |
Reset any options that are not considered when building a module.
Definition at line 253 of file PreprocessorOptions.h.
References ChainedIncludes, DumpDeserializedPCHDecls, ImplicitPCHInclude, Includes, LexEditorPlaceholders, MacroIncludes, PrecompiledPreambleBytes, RetainExcludedConditionalBlocks, RetainRemappedFileBuffers, and SingleFileParseMode.
Referenced by clang::CompilerInvocation::resetNonModularOptions().
When true, a PCH with compiler errors will not be rejected.
Definition at line 127 of file PreprocessorOptions.h.
Referenced by clang::FrontendAction::BeginSourceFile(), and clang::GeneratePCHAction::CreateASTConsumer().
When true, a PCH with modules cache path different to the current compilation will not be rejected.
Definition at line 131 of file PreprocessorOptions.h.
Referenced by checkModuleCachePath().
| std::vector<std::string> clang::PreprocessorOptions::ChainedIncludes |
Headers that will be converted to chained PCHs in memory.
Definition at line 119 of file PreprocessorOptions.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::createChainedIncludesSource(), GeneratePreprocessorArgs(), ParsePreprocessorArgs(), and resetNonModularOptions().
Indicates whether to predefine target OS macros.
Definition at line 92 of file PreprocessorOptions.h.
Referenced by GeneratePreprocessorArgs(), InitializePredefinedMacros(), and ParsePreprocessorArgs().
| std::set<std::string> clang::PreprocessorOptions::DeserializedPCHDeclsToErrorOn |
This is a set of names for decls that we do not want to be deserialized, and we emit an error if they are; for testing purposes.
Definition at line 138 of file PreprocessorOptions.h.
Referenced by clang::FrontendAction::BeginSourceFile(), GeneratePreprocessorArgs(), and ParsePreprocessorArgs().
Whether we should maintain a detailed record of all macro definitions and expansions.
Definition at line 96 of file PreprocessorOptions.h.
Referenced by checkPreprocessorOptions(), clang::ASTUnit::CodeComplete(), clang::CompilerInvocation::computeContextHash(), and clang::CompilerInstance::createPreprocessor().
| DisableValidationForModuleKind clang::PreprocessorOptions::DisablePCHOrModuleValidation |
Whether to disable most of the normal validation performed on precompiled headers and module files.
Definition at line 123 of file PreprocessorOptions.h.
Referenced by clang::FrontendAction::BeginSourceFile(), and clang::CompilerInstance::createASTReader().
Prevents intended crashes when using #pragma clang __debug. For testing.
Definition at line 215 of file PreprocessorOptions.h.
Dump declarations that are deserialized from PCH, for testing.
Definition at line 134 of file PreprocessorOptions.h.
Referenced by clang::FrontendAction::BeginSourceFile(), and resetNonModularOptions().
| std::vector<std::string> clang::PreprocessorOptions::EmbedEntries |
User specified embed entries.
Definition at line 193 of file PreprocessorOptions.h.
Referenced by GeneratePreprocessorArgs(), and ParsePreprocessorArgs().
True indicates that a preamble is being generated.
When the lexer is done, one of the things that need to be preserved is the conditional if stack, so the ASTWriter/ASTReader can save/restore it when processing the rest of the file. Similarly, we track an unterminated #pragma assume_nonnull.
Definition at line 153 of file PreprocessorOptions.h.
Referenced by clang::PrecompiledPreamble::Build(), and clang::Preprocessor::Preprocessor().
| std::string clang::PreprocessorOptions::ImplicitPCHInclude |
The implicit PCH included at the start of the translation unit, or empty.
Definition at line 116 of file PreprocessorOptions.h.
Referenced by clang::FrontendAction::BeginSourceFile(), checkPreprocessorOptions(), collectIncludePCH(), clang::dependencies::computePrebuiltModulesASTMap(), clang::InitializePreprocessor(), and resetNonModularOptions().
| std::vector<std::string> clang::PreprocessorOptions::Includes |
Definition at line 81 of file PreprocessorOptions.h.
Referenced by checkPreprocessorOptions(), GeneratePreprocessorArgs(), clang::InitializePreprocessor(), ParsePreprocessorArgs(), and resetNonModularOptions().
| DateTimeInitKind clang::PreprocessorOptions::InitDateTimeMacros = DateTimeInitKind::Default |
Specify initialization kind for DATE, TIME and TIMESTAMP macros.
Definition at line 226 of file PreprocessorOptions.h.
Referenced by ComputeDATE_TIME().
| uint32_t clang::PreprocessorOptions::InitialCounterValue = 0 |
The initial value for COUNTER; typically is zero but can be set via a -cc1 flag for testing purposes.
Definition at line 222 of file PreprocessorOptions.h.
Referenced by clang::InitializePreprocessor().
When enabled, the preprocessor will construct editor placeholder tokens.
Definition at line 175 of file PreprocessorOptions.h.
Referenced by ParsePreprocessorArgs(), and resetNonModularOptions().
| std::vector<std::string> clang::PreprocessorOptions::MacroIncludes |
Definition at line 82 of file PreprocessorOptions.h.
Referenced by checkPreprocessorOptions(), clang::InitializePreprocessor(), and resetNonModularOptions().
| std::vector<std::pair<std::string, bool> > clang::PreprocessorOptions::Macros |
Definition at line 80 of file PreprocessorOptions.h.
Referenced by addMacroDef(), addMacroUndef(), clang::dependencies::canonicalizeDefines(), collectMacroDefinitions(), GeneratePreprocessorArgs(), clang::InitializePreprocessor(), and makeCommonInvocationForModuleBuild().
Perform extra checks when loading PCM files for mutable file systems.
Definition at line 85 of file PreprocessorOptions.h.
| ObjCXXARCStandardLibraryKind clang::PreprocessorOptions::ObjCXXARCStandardLibrary = ARCXX_nolib |
The Objective-C++ ARC standard library that we should support, by providing appropriate definitions to retrofit the standard library with support for lifetime-qualified pointers.
Definition at line 209 of file PreprocessorOptions.h.
Referenced by clang::InitializePreprocessor().
| std::string clang::PreprocessorOptions::PCHThroughHeader |
If non-empty, the filename used in an #include directive in the primary source file (or command-line preinclude) that is used to implement MSVC-style precompiled headers.
When creating a PCH, after the #include of this header, the PCH generation stops. When using a PCH, tokens are skipped until after an #include of this header is seen.
Definition at line 113 of file PreprocessorOptions.h.
Referenced by checkPreprocessorOptions(), and clang::Preprocessor::Preprocessor().
When true, we are creating or using a PCH where a #pragma hdrstop is expected to indicate the beginning or end of the PCH.
Definition at line 100 of file PreprocessorOptions.h.
Referenced by GeneratePreprocessorArgs(), and ParsePreprocessorArgs().
When true, we are creating a PCH or creating the PCH object while expecting a #pragma hdrstop to separate the two.
Allow for a missing #pragma hdrstop, which generates a PCH for the whole file, and creates an empty PCH object.
Definition at line 106 of file PreprocessorOptions.h.
Referenced by GeneratePreprocessorArgs().
If non-zero, the implicit PCH include is actually a precompiled preamble that covers this number of bytes in the main source file.
The boolean indicates whether the preamble ends at the start of a new line.
Definition at line 145 of file PreprocessorOptions.h.
Referenced by clang::PrecompiledPreamble::Build(), clang::ASTUnit::CodeComplete(), clang::CompilerInstance::createPCHExternalASTSource(), clang::VerifyPCHAction::ExecuteAction(), GeneratePreprocessorArgs(), clang::InitializePreprocessor(), ParsePreprocessorArgs(), PreprocessorOptions(), and resetNonModularOptions().
| std::vector<std::pair<std::string, llvm::MemoryBuffer *> > clang::PreprocessorOptions::RemappedFileBuffers |
The set of file-to-buffer remappings, which take existing files on the system (the first part of each pair) and gives them the contents of the specified memory buffer (the second part of each pair).
Definition at line 190 of file PreprocessorOptions.h.
Referenced by addRemappedFile(), clang::PrecompiledPreamble::CanReuse(), clearRemappedFiles(), and InitializeFileRemapping().
| std::vector<std::pair<std::string, std::string> > clang::PreprocessorOptions::RemappedFiles |
The set of file remappings, which take existing files on the system (the first part of each pair) and gives them the contents of other files on the system (the second part of each pair).
Definition at line 185 of file PreprocessorOptions.h.
Referenced by addRemappedFile(), clang::FixItRecompile::BeginInvocation(), clang::PrecompiledPreamble::CanReuse(), clearRemappedFiles(), GeneratePreprocessorArgs(), and InitializeFileRemapping().
True if the SourceManager should report the original file name for contents of files that were remapped to other files.
Defaults to true.
Definition at line 179 of file PreprocessorOptions.h.
Referenced by clang::FixItRecompile::BeginInvocation(), and InitializeFileRemapping().
When enabled, excluded conditional blocks retain in the main file.
Definition at line 204 of file PreprocessorOptions.h.
Referenced by resetNonModularOptions().
Whether the compiler instance should retain (i.e., not free) the buffers associated with remapped files.
This flag defaults to false; it can be set true only through direct manipulation of the compiler invocation object, in cases where the compiler invocation and its buffers will be reused.
Definition at line 201 of file PreprocessorOptions.h.
Referenced by clang::PrecompiledPreamble::Build(), clang::ASTUnit::CodeComplete(), InitializeFileRemapping(), and resetNonModularOptions().
Set up preprocessor for RunAnalysis action.
Definition at line 212 of file PreprocessorOptions.h.
Referenced by InitializePredefinedMacros().
When enabled, preprocessor is in a mode for parsing a single file only.
Disables #includes of other files and if there are unresolved identifiers in preprocessor directive conditions it causes all blocks to be parsed so that the client can get the maximum amount of information from the parser.
Definition at line 165 of file PreprocessorOptions.h.
Referenced by EvaluateDirectiveSubExpr(), and resetNonModularOptions().
When enabled, preprocessor is in a mode for parsing a single module only.
Disables imports of other modules and if there are any unresolved identifiers in preprocessor directive conditions it causes all blocks to be skipped so that the client can get a strict subset of the contents.
Definition at line 172 of file PreprocessorOptions.h.
Referenced by SingleModuleWithAsyncModuleCompiles::BeginSourceFileAction(), SingleTUWithAsyncModuleCompiles::BeginSourceFileAction(), and EvaluateDirectiveSubExpr().
| std::optional<uint64_t> clang::PreprocessorOptions::SourceDateEpoch |
If set, the UNIX timestamp specified by SOURCE_DATE_EPOCH.
Definition at line 218 of file PreprocessorOptions.h.
Referenced by ComputeDATE_TIME(), GeneratePreprocessorArgs(), and ParsePreprocessorArgs().
Initialize the preprocessor with the compiler and target specific predefines.
Definition at line 89 of file PreprocessorOptions.h.
Referenced by checkPreprocessorOptions(), clang::CompilerInvocation::computeContextHash(), and clang::InitializePreprocessor().
Whether to write comment locations into the PCH when building it.
Reading the comments from the PCH can be a performance hit even if the clients don't use them.
Definition at line 158 of file PreprocessorOptions.h.