#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "clang/Driver/Options.inc" #include "clang/StaticAnalyzer/Core/Analyses.def" #include "clang/StaticAnalyzer/Core/AnalyzerOptions.def" #include "clang/Basic/CFProtectionOptions.def" #include "clang/Basic/LangStandards.def" #include "clang/Basic/LangOptions.def" #include "clang/Basic/DiagnosticOptions.def" #include "clang/Basic/DebugOptions.def"">

clang: lib/Frontend/CompilerInvocation.cpp File Reference (original) (raw)

#include "[clang/Frontend/CompilerInvocation.h](CompilerInvocation%5F8h%5Fsource.html)"
#include "[TestModuleFileExtension.h](TestModuleFileExtension%5F8h%5Fsource.html)"
#include "[clang/Basic/Builtins.h](Builtins%5F8h%5Fsource.html)"
#include "[clang/Basic/CharInfo.h](CharInfo%5F8h%5Fsource.html)"
#include "[clang/Basic/CodeGenOptions.h](CodeGenOptions%5F8h%5Fsource.html)"
#include "[clang/Basic/CommentOptions.h](CommentOptions%5F8h%5Fsource.html)"
#include "[clang/Basic/Diagnostic.h](Basic%5F2Diagnostic%5F8h%5Fsource.html)"
#include "[clang/Basic/DiagnosticDriver.h](DiagnosticDriver%5F8h%5Fsource.html)"
#include "[clang/Basic/DiagnosticOptions.h](DiagnosticOptions%5F8h%5Fsource.html)"
#include "[clang/Basic/FileSystemOptions.h](FileSystemOptions%5F8h%5Fsource.html)"
#include "[clang/Basic/LLVM.h](LLVM%5F8h%5Fsource.html)"
#include "[clang/Basic/LangOptions.h](LangOptions%5F8h%5Fsource.html)"
#include "[clang/Basic/LangStandard.h](LangStandard%5F8h%5Fsource.html)"
#include "[clang/Basic/ObjCRuntime.h](ObjCRuntime%5F8h%5Fsource.html)"
#include "[clang/Basic/Sanitizers.h](Sanitizers%5F8h%5Fsource.html)"
#include "[clang/Basic/SourceLocation.h](SourceLocation%5F8h%5Fsource.html)"
#include "[clang/Basic/TargetOptions.h](TargetOptions%5F8h%5Fsource.html)"
#include "[clang/Basic/Version.h](Version%5F8h%5Fsource.html)"
#include "[clang/Basic/Visibility.h](Visibility%5F8h%5Fsource.html)"
#include "[clang/Basic/XRayInstr.h](XRayInstr%5F8h%5Fsource.html)"
#include "clang/Config/config.h"
#include "[clang/Driver/Driver.h](Driver%5F8h%5Fsource.html)"
#include "[clang/Driver/DriverDiagnostic.h](DriverDiagnostic%5F8h%5Fsource.html)"
#include "[clang/Driver/Options.h](Options%5F8h%5Fsource.html)"
#include "[clang/Frontend/CommandLineSourceLoc.h](CommandLineSourceLoc%5F8h%5Fsource.html)"
#include "[clang/Frontend/DependencyOutputOptions.h](DependencyOutputOptions%5F8h%5Fsource.html)"
#include "[clang/Frontend/FrontendDiagnostic.h](FrontendDiagnostic%5F8h%5Fsource.html)"
#include "[clang/Frontend/FrontendOptions.h](FrontendOptions%5F8h%5Fsource.html)"
#include "[clang/Frontend/FrontendPluginRegistry.h](FrontendPluginRegistry%5F8h%5Fsource.html)"
#include "[clang/Frontend/MigratorOptions.h](MigratorOptions%5F8h%5Fsource.html)"
#include "[clang/Frontend/PreprocessorOutputOptions.h](PreprocessorOutputOptions%5F8h%5Fsource.html)"
#include "[clang/Frontend/TextDiagnosticBuffer.h](TextDiagnosticBuffer%5F8h%5Fsource.html)"
#include "[clang/Frontend/Utils.h](Frontend%5F2Utils%5F8h%5Fsource.html)"
#include "[clang/Lex/HeaderSearchOptions.h](HeaderSearchOptions%5F8h%5Fsource.html)"
#include "[clang/Lex/PreprocessorOptions.h](PreprocessorOptions%5F8h%5Fsource.html)"
#include "[clang/Sema/CodeCompleteOptions.h](CodeCompleteOptions%5F8h%5Fsource.html)"
#include "[clang/Serialization/ASTBitCodes.h](ASTBitCodes%5F8h%5Fsource.html)"
#include "[clang/Serialization/ModuleFileExtension.h](ModuleFileExtension%5F8h%5Fsource.html)"
#include "[clang/StaticAnalyzer/Core/AnalyzerOptions.h](AnalyzerOptions%5F8h%5Fsource.html)"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/CachedHashString.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Frontend/Debug/Options.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/Linker/Linker.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/OptSpecifier.h"
#include "llvm/Option/OptTable.h"
#include "llvm/Option/Option.h"
#include "llvm/ProfileData/InstrProfReader.h"
#include "llvm/Remarks/HotnessThresholdParser.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/HashBuilder.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/VersionTuple.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/TargetParser/Host.h"
#include "llvm/TargetParser/Triple.h"
#include <algorithm>
#include <atomic>
#include <cassert>
#include <cstddef>
#include <cstring>
#include <ctime>
#include <fstream>
#include <limits>
#include <memory>
#include <optional>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
#include "clang/Driver/Options.inc"
#include "clang/StaticAnalyzer/Core/Analyses.def"
#include "clang/StaticAnalyzer/Core/AnalyzerOptions.def"
#include "clang/Basic/CFProtectionOptions.def"
#include "clang/Basic/LangStandards.def"
#include "clang/Basic/LangOptions.def"
#include "clang/Basic/DiagnosticOptions.def"
#include "clang/Basic/DebugOptions.def"

Go to the source code of this file.

Macros
#define OPTTABLE_STR_TABLE_CODE
#define SIMPLE_ENUM_VALUE_TABLE
#define PARSE_OPTION_WITH_MARSHALLING( ARGS, DIAGS, PREFIX_TYPE, SPELLING_OFFSET, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, VISIBILITY, PARAM, HELPTEXT, HELPTEXTSFORVARIANTS, METAVAR, VALUES, SHOULD_PARSE, ALWAYS_EMIT, KEYPATH, DEFAULT_VALUE, IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER, DENORMALIZER, MERGER, EXTRACTOR, TABLE_INDEX)
#define GENERATE_OPTION_WITH_MARSHALLING( CONSUMER, PREFIX_TYPE, SPELLING_OFFSET, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, VISIBILITY, PARAM, HELPTEXT, HELPTEXTSFORVARIANTS, METAVAR, VALUES, SHOULD_PARSE, ALWAYS_EMIT, KEYPATH, DEFAULT_VALUE, IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER, DENORMALIZER, MERGER, EXTRACTOR, TABLE_INDEX)
#define ANALYZER_OPTION_WITH_MARSHALLING(...) GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)
#define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN)
#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN)
#define ANALYSIS_PURGE(NAME, CMDFLAG, DESC)
#define ANALYSIS_INLINING_MODE(NAME, CMDFLAG, DESC)
#define ANALYZER_OPTION_WITH_MARSHALLING(...) PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)
#define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN) .Case(CMDFLAG, NAME##Model)
#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN) .Case(CMDFLAG, PD_##NAME)
#define ANALYSIS_PURGE(NAME, CMDFLAG, DESC) .Case(CMDFLAG, NAME)
#define ANALYSIS_INLINING_MODE(NAME, CMDFLAG, DESC) .Case(CMDFLAG, NAME)
#define ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, DEFAULT_VAL) initOption(AnOpts.Config, Diags, AnOpts.NAME, CMDFLAG, DEFAULT_VAL);
#define ANALYZER_OPTION_DEPENDS_ON_USER_MODE(...)
#define ANALYZER_OPTION(...)
#define ANALYZER_OPTION_DEPENDS_ON_USER_MODE(TYPE, NAME, CMDFLAG, DESC, SHALLOW_VAL, DEEP_VAL)
#define CODEGEN_OPTION_WITH_MARSHALLING(...) GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)
#define CF_BRANCH_LABEL_SCHEME(Kind, FlagVal)
#define CODEGEN_OPTION_WITH_MARSHALLING(...) PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)
#define CF_BRANCH_LABEL_SCHEME(Kind, FlagVal) .Case(#FlagVal, CFBranchLabelSchemeKind::Kind)
#define DEPENDENCY_OUTPUT_OPTION_WITH_MARSHALLING(...) GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)
#define DEPENDENCY_OUTPUT_OPTION_WITH_MARSHALLING(...) PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)
#define FILE_SYSTEM_OPTION_WITH_MARSHALLING(...) GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)
#define FILE_SYSTEM_OPTION_WITH_MARSHALLING(...) PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)
#define MIGRATOR_OPTION_WITH_MARSHALLING(...) GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)
#define MIGRATOR_OPTION_WITH_MARSHALLING(...) PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)
#define DIAG_OPTION_WITH_MARSHALLING(...) GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)
#define DIAG_OPTION_WITH_MARSHALLING(...) PARSE_OPTION_WITH_MARSHALLING(Args, *Diags, __VA_ARGS__)
#define FRONTEND_OPTION_WITH_MARSHALLING(...) GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)
#define FRONTEND_OPTION_WITH_MARSHALLING(...) PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)
#define HEADER_SEARCH_OPTION_WITH_MARSHALLING(...) GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)
#define HEADER_SEARCH_OPTION_WITH_MARSHALLING(...) PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)
#define LANG_OPTION_WITH_MARSHALLING(...) GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)
#define LANGSTANDARD(id, name, lang, desc, features)
#define LANGSTANDARD_ALIAS(id, alias) if (KindValue == LangStandard::lang_##id) ++NumAliases;
#define LANGSTANDARD_ALIAS_DEPR(id, alias)
#define LANGSTANDARD(id, name, lang, desc, features)
#define LANGSTANDARD_ALIAS(id, alias) if (KindValue == LangStandard::lang_##id) Diag << alias;
#define LANGSTANDARD_ALIAS_DEPR(id, alias)
#define LANG_OPTION_WITH_MARSHALLING(...) PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)
#define CF_BRANCH_LABEL_SCHEME(Kind, FlagVal) .Case(#FlagVal, CFBranchLabelSchemeKind::Kind)
#define PREPROCESSOR_OPTION_WITH_MARSHALLING(...) GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)
#define PREPROCESSOR_OPTION_WITH_MARSHALLING(...) PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)
#define PREPROCESSOR_OUTPUT_OPTION_WITH_MARSHALLING(...) GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)
#define PREPROCESSOR_OUTPUT_OPTION_WITH_MARSHALLING(...) PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)
#define TARGET_OPTION_WITH_MARSHALLING(...) GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)
#define TARGET_OPTION_WITH_MARSHALLING(...) PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)
#define LANGOPT(Name, Bits, Default, Description) HBuilder.add(LangOpts->Name);
#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) HBuilder.add(static_cast<unsigned>(LangOpts->get##Name()));
#define BENIGN_LANGOPT(Name, Bits, Default, Description)
#define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description)
#define DIAGOPT(Name, Bits, Default) HBuilder.add(diagOpts.Name);
#define ENUM_DIAGOPT(Name, Type, Bits, Default) HBuilder.add(diagOpts.get##Name());
#define DEBUGOPT(Name, Bits, Default) HBuilder.add(CodeGenOpts->Name);
#define VALUE_DEBUGOPT(Name, Bits, Default) HBuilder.add(CodeGenOpts->Name);
#define ENUM_DEBUGOPT(Name, Type, Bits, Default) HBuilder.add(static_cast<unsigned>(CodeGenOpts->get##Name()));
#define BENIGN_DEBUGOPT(Name, Bits, Default)
#define BENIGN_VALUE_DEBUGOPT(Name, Bits, Default)
#define BENIGN_ENUM_DEBUGOPT(Name, Type, Bits, Default)
Typedefs
using ArgumentConsumer = CompilerInvocation::ArgumentConsumer
using ParseFn = llvm::function_ref< bool(CompilerInvocation &, ArrayRef< const char * >, DiagnosticsEngine &, const char *)>
using GenerateFn = llvm::function_ref< void(CompilerInvocation &, SmallVectorImpl< const char * > &, CompilerInvocation::StringAllocator)>
Functions
static Expected< std::optional< uint32_t > > parseToleranceOption (StringRef Arg)
static llvm::StringRef lookupStrInTable (unsigned Offset)
static std::optional< bool > normalizeSimpleFlag (OptSpecifier Opt, unsigned TableIndex, const ArgList &Args, DiagnosticsEngine &Diags)
static std::optional< bool > normalizeSimpleNegativeFlag (OptSpecifier Opt, unsigned, const ArgList &Args, DiagnosticsEngine &)
static void denormalizeSimpleFlag (ArgumentConsumer Consumer, unsigned SpellingOffset, Option::OptionClass, unsigned,...)
The tblgen-erated code passes in a fifth parameter of an arbitrary type, but denormalizeSimpleFlags never looks at it.
static void denormalizeSimpleFlag (ArgumentConsumer Consumer, const Twine &Spelling, Option::OptionClass, unsigned,...)
template
static constexpr bool is_uint64_t_convertible ()
template<typename T , std::enable_if_t<is\_uint64\_t\_convertible< T >(), bool > = false>
static auto makeFlagToValueNormalizer (T Value)
static auto makeBooleanOptionNormalizer (bool Value, bool OtherValue, OptSpecifier OtherOpt)
static auto makeBooleanOptionDenormalizer (bool Value)
static void denormalizeStringImpl (ArgumentConsumer Consumer, const Twine &Spelling, Option::OptionClass OptClass, unsigned, const Twine &Value)
template
static void denormalizeString (ArgumentConsumer Consumer, unsigned SpellingOffset, Option::OptionClass OptClass, unsigned TableIndex, T Value)
template
static void denormalizeString (ArgumentConsumer Consumer, const Twine &Spelling, Option::OptionClass OptClass, unsigned TableIndex, T Value)
static std::optional< SimpleEnumValue > findValueTableByName (const SimpleEnumValueTable &Table, StringRef Name)
static std::optional< SimpleEnumValue > findValueTableByValue (const SimpleEnumValueTable &Table, unsigned Value)
static std::optional< unsigned > normalizeSimpleEnum (OptSpecifier Opt, unsigned TableIndex, const ArgList &Args, DiagnosticsEngine &Diags)
static void denormalizeSimpleEnumImpl (ArgumentConsumer Consumer, unsigned SpellingOffset, Option::OptionClass OptClass, unsigned TableIndex, unsigned Value)
template
static void denormalizeSimpleEnum (ArgumentConsumer Consumer, unsigned SpellingOffset, Option::OptionClass OptClass, unsigned TableIndex, T Value)
static std::optional< std::string > normalizeString (OptSpecifier Opt, int TableIndex, const ArgList &Args, DiagnosticsEngine &Diags)
template
static std::optional< IntTy > normalizeStringIntegral (OptSpecifier Opt, int, const ArgList &Args, DiagnosticsEngine &Diags)
static std::optional< std::vector< std::string > > normalizeStringVector (OptSpecifier Opt, int, const ArgList &Args, DiagnosticsEngine &)
static void denormalizeStringVector (ArgumentConsumer Consumer, unsigned SpellingOffset, Option::OptionClass OptClass, unsigned TableIndex, const std::vector< std::string > &Values)
static std::optional< std::string > normalizeTriple (OptSpecifier Opt, int TableIndex, const ArgList &Args, DiagnosticsEngine &Diags)
template<typename T , typename U >
static T mergeForwardValue (T KeyPath, U Value)
template<typename T , typename U >
static T mergeMaskValue (T KeyPath, U Value)
template
static T extractForwardValue (T KeyPath)
template<typename T , typename U , U Value>
static T extractMaskValue (T KeyPath)
static StringRef GetInputKindName (InputKind IK)
Get language name for given input kind.
static bool FixupInvocation (CompilerInvocation &Invocation, DiagnosticsEngine &Diags, const ArgList &Args, InputKind IK)
static unsigned getOptimizationLevel (ArgList &Args, InputKind IK, DiagnosticsEngine &Diags)
static unsigned getOptimizationLevelSize (ArgList &Args)
static void GenerateArg (ArgumentConsumer Consumer, llvm::opt::OptSpecifier OptSpecifier)
static void GenerateArg (ArgumentConsumer Consumer, llvm::opt::OptSpecifier OptSpecifier, const Twine &Value)
static bool RoundTrip (ParseFn Parse, GenerateFn Generate, CompilerInvocation &RealInvocation, CompilerInvocation &DummyInvocation, ArrayRef< const char * > CommandLineArgs, DiagnosticsEngine &Diags, const char *Argv0, bool CheckAgainstOriginalInvocation=false, bool ForceRoundTrip=false)
May perform round-trip of command line arguments.
static void addDiagnosticArgs (ArgList &Args, OptSpecifier Group, OptSpecifier GroupWithValue, std::vector< std::string > &Diagnostics)
static void parseAnalyzerConfigs (AnalyzerOptions &AnOpts, DiagnosticsEngine *Diags)
static void getAllNoBuiltinFuncValues (ArgList &Args, std::vector< std::string > &Funcs)
static void GenerateAnalyzerArgs (const AnalyzerOptions &Opts, ArgumentConsumer Consumer)
static bool ParseAnalyzerArgs (AnalyzerOptions &Opts, ArgList &Args, DiagnosticsEngine &Diags)
static StringRef getStringOption (AnalyzerOptions::ConfigTable &Config, StringRef OptionName, StringRef DefaultVal)
static void initOption (AnalyzerOptions::ConfigTable &Config, DiagnosticsEngine *Diags, StringRef &OptionField, StringRef Name, StringRef DefaultVal)
static void initOption (AnalyzerOptions::ConfigTable &Config, DiagnosticsEngine *Diags, bool &OptionField, StringRef Name, bool DefaultVal)
static void initOption (AnalyzerOptions::ConfigTable &Config, DiagnosticsEngine *Diags, unsigned &OptionField, StringRef Name, unsigned DefaultVal)
static void initOption (AnalyzerOptions::ConfigTable &Config, DiagnosticsEngine *Diags, PositiveAnalyzerOption &OptionField, StringRef Name, unsigned DefaultVal)
static void GenerateOptimizationRemark (ArgumentConsumer Consumer, OptSpecifier OptEQ, StringRef Name, const CodeGenOptions::OptRemark &Remark)
Generate a remark argument. This is an inverse of ParseOptimizationRemark.
static CodeGenOptions::OptRemark ParseOptimizationRemark (DiagnosticsEngine &Diags, ArgList &Args, OptSpecifier OptEQ, StringRef Name)
Parse a remark command line argument.
static bool parseDiagnosticLevelMask (StringRef FlagName, const std::vector< std::string > &Levels, DiagnosticsEngine &Diags, DiagnosticLevelMask &M)
static void parseSanitizerKinds (StringRef FlagName, const std::vector< std::string > &Sanitizers, DiagnosticsEngine &Diags, SanitizerSet &S)
static SmallVector< StringRef, 4 > serializeSanitizerKinds (SanitizerSet S)
static SanitizerMaskCutoffs parseSanitizerWeightedKinds (StringRef FlagName, const std::vector< std::string > &Sanitizers, DiagnosticsEngine &Diags)
static void parseXRayInstrumentationBundle (StringRef FlagName, StringRef Bundle, ArgList &Args, DiagnosticsEngine &D, XRayInstrSet &S)
static std::string serializeXRayInstrumentationBundle (const XRayInstrSet &S)
static void setPGOUseInstrumentor (CodeGenOptions &Opts, const Twine &ProfileName, llvm::vfs::FileSystem &FS, DiagnosticsEngine &Diags)
static void parsePointerAuthOptions (PointerAuthOptions &Opts, const LangOptions &LangOpts, const llvm::Triple &Triple, DiagnosticsEngine &Diags)
static void GenerateDependencyOutputArgs (const DependencyOutputOptions &Opts, ArgumentConsumer Consumer)
static bool ParseDependencyOutputArgs (DependencyOutputOptions &Opts, ArgList &Args, DiagnosticsEngine &Diags, frontend::ActionKind Action, bool ShowLineMarkers)
static bool parseShowColorsArgs (const ArgList &Args, bool DefaultColor)
static bool checkVerifyPrefixes (const std::vector< std::string > &VerifyPrefixes, DiagnosticsEngine &Diags)
static void GenerateFileSystemArgs (const FileSystemOptions &Opts, ArgumentConsumer Consumer)
static bool ParseFileSystemArgs (FileSystemOptions &Opts, const ArgList &Args, DiagnosticsEngine &Diags)
static void GenerateMigratorArgs (const MigratorOptions &Opts, ArgumentConsumer Consumer)
static bool ParseMigratorArgs (MigratorOptions &Opts, const ArgList &Args, DiagnosticsEngine &Diags)
static bool parseTestModuleFileExtensionArg (StringRef Arg, std::string &BlockName, unsigned &MajorVersion, unsigned &MinorVersion, bool &Hashed, std::string &UserInfo)
Parse the argument to the -ftest-module-file-extension command-line argument.
static const auto & getFrontendActionTable ()
Return a table that associates command line option specifiers with the frontend action.
static std::optional< frontend::ActionKind > getFrontendAction (OptSpecifier &Opt)
Maps command line option to frontend action.
static std::optional< OptSpecifier > getProgramActionOpt (frontend::ActionKind ProgramAction)
Maps frontend action to command line option.
static void GenerateFrontendArgs (const FrontendOptions &Opts, ArgumentConsumer Consumer, bool IsHeader)
static bool ParseFrontendArgs (FrontendOptions &Opts, ArgList &Args, DiagnosticsEngine &Diags, bool &IsHeaderFile)
static void GenerateHeaderSearchArgs (const HeaderSearchOptions &Opts, ArgumentConsumer Consumer)
static bool ParseHeaderSearchArgs (HeaderSearchOptions &Opts, ArgList &Args, DiagnosticsEngine &Diags, const std::string &WorkingDir)
static void GenerateAPINotesArgs (const APINotesOptions &Opts, ArgumentConsumer Consumer)
static void ParseAPINotesArgs (APINotesOptions &Opts, ArgList &Args, DiagnosticsEngine &diags)
static void GeneratePointerAuthArgs (const LangOptions &Opts, ArgumentConsumer Consumer)
static void ParsePointerAuthArgs (LangOptions &Opts, ArgList &Args, DiagnosticsEngine &Diags)
static bool IsInputCompatibleWithStandard (InputKind IK, const LangStandard &S)
Check if input file kind and language standard are compatible.
static bool isStrictlyPreprocessorAction (frontend::ActionKind Action)
static void GeneratePreprocessorArgs (const PreprocessorOptions &Opts, ArgumentConsumer Consumer, const LangOptions &LangOpts, const FrontendOptions &FrontendOpts, const CodeGenOptions &CodeGenOpts)
static bool ParsePreprocessorArgs (PreprocessorOptions &Opts, ArgList &Args, DiagnosticsEngine &Diags, frontend::ActionKind Action, const FrontendOptions &FrontendOpts)
static void GeneratePreprocessorOutputArgs (const PreprocessorOutputOptions &Opts, ArgumentConsumer Consumer, frontend::ActionKind Action)
static bool ParsePreprocessorOutputArgs (PreprocessorOutputOptions &Opts, ArgList &Args, DiagnosticsEngine &Diags, frontend::ActionKind Action)
static void GenerateTargetArgs (const TargetOptions &Opts, ArgumentConsumer Consumer)
static bool ParseTargetArgs (TargetOptions &Opts, ArgList &Args, DiagnosticsEngine &Diags)

ANALYSIS_CONSTRAINTS [1/2]

| #define ANALYSIS_CONSTRAINTS | ( | | NAME, | | ----------------------------- | - | | ----- | | | CMDFLAG, | | | | | | DESC, | | | | | | CREATFN | | | | | ) | | | |

Value:

case NAME##Model: \

GenerateArg(Consumer, OPT_analyzer_constraints, CMDFLAG); \

break;

ANALYSIS_CONSTRAINTS [2/2]

| #define ANALYSIS_CONSTRAINTS | ( | | NAME, | | ----------------------------- | --------------------------- | | ----- | | | CMDFLAG, | | | | | | DESC, | | | | | | CREATFN | | | | | ) | .Case(CMDFLAG, NAME##Model) | | |

ANALYSIS_DIAGNOSTICS [1/2]

| #define ANALYSIS_DIAGNOSTICS | ( | | NAME, | | ----------------------------- | - | | ----- | | | CMDFLAG, | | | | | | DESC, | | | | | | CREATFN | | | | | ) | | | |

Value:

case PD_##NAME: \

GenerateArg(Consumer, OPT_analyzer_output, CMDFLAG); \

break;

ANALYSIS_DIAGNOSTICS [2/2]

| #define ANALYSIS_DIAGNOSTICS | ( | | NAME, | | ----------------------------- | -------------------------- | | ----- | | | CMDFLAG, | | | | | | DESC, | | | | | | CREATFN | | | | | ) | .Case(CMDFLAG, PD_##NAME) | | |

ANALYSIS_INLINING_MODE [1/2]

| #define ANALYSIS_INLINING_MODE | ( | | NAME, | | -------------------------------- | - | | ----- | | | CMDFLAG, | | | | | | DESC | | | | | ) | | | |

Value:

case NAME: \

GenerateArg(Consumer, OPT_analyzer_inlining_mode, CMDFLAG); \

break;

ANALYSIS_INLINING_MODE [2/2]

| #define ANALYSIS_INLINING_MODE | ( | | NAME, | | -------------------------------- | -------------------- | | ----- | | | CMDFLAG, | | | | | | DESC | | | | | ) | .Case(CMDFLAG, NAME) | | |

ANALYSIS_PURGE [1/2]

| #define ANALYSIS_PURGE | ( | | NAME, | | ----------------------- | - | | ----- | | | CMDFLAG, | | | | | | DESC | | | | | ) | | | |

Value:

case NAME: \

GenerateArg(Consumer, OPT_analyzer_purge, CMDFLAG); \

break;

ANALYSIS_PURGE [2/2]

| #define ANALYSIS_PURGE | ( | | NAME, | | ----------------------- | -------------------- | | ----- | | | CMDFLAG, | | | | | | DESC | | | | | ) | .Case(CMDFLAG, NAME) | | |

ANALYZER_OPTION [1/2]

| #define ANALYZER_OPTION | ( | | ... | ) | | ------------------------ | - | | ----- | - |

ANALYZER_OPTION [2/2]

| #define ANALYZER_OPTION | ( | | TYPE, | | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | | ----------------------------------------------------------- | | | NAME, | | | | | | CMDFLAG, | | | | | | DESC, | | | | | | DEFAULT_VAL | | | | | ) | initOption(AnOpts.Config, Diags, AnOpts.NAME, CMDFLAG, DEFAULT_VAL); | | |

ANALYZER_OPTION_DEPENDS_ON_USER_MODE [1/2]

| #define ANALYZER_OPTION_DEPENDS_ON_USER_MODE | ( | | ... | ) | | ------------------------------------------------- | - | | ----- | - |

ANALYZER_OPTION_DEPENDS_ON_USER_MODE [2/2]

| #define ANALYZER_OPTION_DEPENDS_ON_USER_MODE | ( | | TYPE, | | ------------------------------------------------- | - | | ----------------------------------------------------------- | | | NAME, | | | | | | CMDFLAG, | | | | | | DESC, | | | | | | SHALLOW_VAL, | | | | | | DEEP_VAL | | | | | ) | | | |

Value:

initOption(AnOpts.Config, Diags, AnOpts.NAME, CMDFLAG, \

InShallowMode ? SHALLOW_VAL : DEEP_VAL);

static void initOption(AnalyzerOptions::ConfigTable &Config, DiagnosticsEngine *Diags, StringRef &OptionField, StringRef Name, StringRef DefaultVal)

ANALYZER_OPTION_WITH_MARSHALLING [1/2]

ANALYZER_OPTION_WITH_MARSHALLING [2/2]

BENIGN_DEBUGOPT

| #define BENIGN_DEBUGOPT | ( | | Name, | | ------------------------ | - | | ----- | | | Bits, | | | | | | Default | | | | | ) | | | |

BENIGN_ENUM_DEBUGOPT

| #define BENIGN_ENUM_DEBUGOPT | ( | | Name, | | ------------------------------------------------------------------------ | - | | ----- | | | Type, | | | | | | Bits, | | | | | | Default | | | | | ) | | | |

BENIGN_ENUM_LANGOPT

| #define BENIGN_ENUM_LANGOPT | ( | | Name, | | ------------------------------------------------------------------------ | - | | ----- | | | Type, | | | | | | Bits, | | | | | | Default, | | | | | | Description | | | | | ) | | | |

BENIGN_LANGOPT

| #define BENIGN_LANGOPT | ( | | Name, | | ----------------------- | - | | ----- | | | Bits, | | | | | | Default, | | | | | | Description | | | | | ) | | | |

BENIGN_VALUE_DEBUGOPT

| #define BENIGN_VALUE_DEBUGOPT | ( | | Name, | | ------------------------------- | - | | ----- | | | Bits, | | | | | | Default | | | | | ) | | | |

CF_BRANCH_LABEL_SCHEME [1/3]

| #define CF_BRANCH_LABEL_SCHEME | ( | | Kind, | | --------------------------------- | - | | ------------------------------------------------------------------------ | | | FlagVal | | | | | ) | | | |

Value:

case CFBranchLabelSchemeKind::Kind: \

GenerateArg(Consumer, OPT_mcf_branch_label_scheme_EQ, #FlagVal); \

break;

CF_BRANCH_LABEL_SCHEME [2/3]

CF_BRANCH_LABEL_SCHEME [3/3]

CODEGEN_OPTION_WITH_MARSHALLING [1/2]

CODEGEN_OPTION_WITH_MARSHALLING [2/2]

DEBUGOPT

| #define DEBUGOPT | ( | | Name, | | ---------------- | -------------------------------- | | ----- | | | Bits, | | | | | | Default | | | | | ) | HBuilder.add(CodeGenOpts->Name); | | |

DEPENDENCY_OUTPUT_OPTION_WITH_MARSHALLING [1/2]

DEPENDENCY_OUTPUT_OPTION_WITH_MARSHALLING [2/2]

DIAG_OPTION_WITH_MARSHALLING [1/2]

DIAG_OPTION_WITH_MARSHALLING [2/2]

DIAGOPT

| #define DIAGOPT | ( | | Name, | | --------------- | ---------------------------- | | ----- | | | Bits, | | | | | | Default | | | | | ) | HBuilder.add(diagOpts.Name); | | |

ENUM_DEBUGOPT

| #define ENUM_DEBUGOPT | ( | | Name, | | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- | | ----- | | | Type, | | | | | | Bits, | | | | | | Default | | | | | ) | HBuilder.add(static_cast<unsigned>(CodeGenOpts->get##Name())); | | |

ENUM_DIAGOPT

| #define ENUM_DIAGOPT | ( | | Name, | | ------------------------------------------------------------------------ | ----------------------------------- | | ----- | | | Type, | | | | | | Bits, | | | | | | Default | | | | | ) | HBuilder.add(diagOpts.get##Name()); | | |

ENUM_LANGOPT

| #define ENUM_LANGOPT | ( | | Name, | | ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------- | | ----- | | | Type, | | | | | | Bits, | | | | | | Default, | | | | | | Description | | | | | ) | HBuilder.add(static_cast<unsigned>(LangOpts->get##Name())); | | |

FILE_SYSTEM_OPTION_WITH_MARSHALLING [1/2]

FILE_SYSTEM_OPTION_WITH_MARSHALLING [2/2]

FRONTEND_OPTION_WITH_MARSHALLING [1/2]

FRONTEND_OPTION_WITH_MARSHALLING [2/2]

GENERATE_OPTION_WITH_MARSHALLING

| #define GENERATE_OPTION_WITH_MARSHALLING | ( | | CONSUMER, | | -------------------------------------------------------------------------------------------- | - | | --------- | | | PREFIX_TYPE, | | | | | | SPELLING_OFFSET, | | | | | | ID, | | | | | | KIND, | | | | | | GROUP, | | | | | | ALIAS, | | | | | | ALIASARGS, | | | | | | FLAGS, | | | | | | VISIBILITY, | | | | | | PARAM, | | | | | | HELPTEXT, | | | | | | HELPTEXTSFORVARIANTS, | | | | | | METAVAR, | | | | | | VALUES, | | | | | | SHOULD_PARSE, | | | | | | ALWAYS_EMIT, | | | | | | KEYPATH, | | | | | | DEFAULT_VALUE, | | | | | | IMPLIED_CHECK, | | | | | | IMPLIED_VALUE, | | | | | | NORMALIZER, | | | | | | DENORMALIZER, | | | | | | MERGER, | | | | | | EXTRACTOR, | | | | | | TABLE_INDEX | | | | | ) | | | |

Value:

[&](const auto &Extracted) { \

if (ALWAYS_EMIT || \

(Extracted != \

static_cast<decltype(KEYPATH)>((IMPLIED_CHECK) ? (IMPLIED_VALUE) \

: (DEFAULT_VALUE)))) \

DENORMALIZER(CONSUMER, SPELLING_OFFSET, Option::KIND##Class, \

TABLE_INDEX, Extracted); \

}(EXTRACTOR(KEYPATH)); \

}

Definition at line 574 of file CompilerInvocation.cpp.

HEADER_SEARCH_OPTION_WITH_MARSHALLING [1/2]

HEADER_SEARCH_OPTION_WITH_MARSHALLING [2/2]

LANG_OPTION_WITH_MARSHALLING [1/2]

LANG_OPTION_WITH_MARSHALLING [2/2]

LANGOPT

| #define LANGOPT | ( | | Name, | | --------------- | ----------------------------- | | ----- | | | Bits, | | | | | | Default, | | | | | | Description | | | | | ) | HBuilder.add(LangOpts->Name); | | |

LANGSTANDARD [1/2]

| #define LANGSTANDARD | ( | | id, | | -------------------- | - | | --- | | | name, | | | | | | lang, | | | | | | desc, | | | | | | features | | | | | ) | | | |

LANGSTANDARD [2/2]

| #define LANGSTANDARD | ( | | id, | | -------------------- | - | | --- | | | name, | | | | | | lang, | | | | | | desc, | | | | | | features | | | | | ) | | | |

LANGSTANDARD_ALIAS [1/2]

| #define LANGSTANDARD_ALIAS | ( | | id, | | --------------------------- | --------------------------------------------------------------------------------------------------------------------- | | --- | | | alias | | | | | ) | if (KindValue == LangStandard::lang_##id) ++NumAliases; | | |

LANGSTANDARD_ALIAS [2/2]

| #define LANGSTANDARD_ALIAS | ( | | id, | | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | --- | | | alias | | | | | ) | if (KindValue == LangStandard::lang_##id) Diag << alias; | | |

LANGSTANDARD_ALIAS_DEPR [1/2]

| #define LANGSTANDARD_ALIAS_DEPR | ( | | id, | | --------------------------------- | - | | --- | | | alias | | | | | ) | | | |

LANGSTANDARD_ALIAS_DEPR [2/2]

| #define LANGSTANDARD_ALIAS_DEPR | ( | | id, | | --------------------------------- | - | | --- | | | alias | | | | | ) | | | |

MIGRATOR_OPTION_WITH_MARSHALLING [1/2]

MIGRATOR_OPTION_WITH_MARSHALLING [2/2]

OPTTABLE_STR_TABLE_CODE

#define OPTTABLE_STR_TABLE_CODE

PARSE_OPTION_WITH_MARSHALLING

| #define PARSE_OPTION_WITH_MARSHALLING | ( | | ARGS, | | -------------------------------------------------------------------------------------------- | - | | ----- | | | DIAGS, | | | | | | PREFIX_TYPE, | | | | | | SPELLING_OFFSET, | | | | | | ID, | | | | | | KIND, | | | | | | GROUP, | | | | | | ALIAS, | | | | | | ALIASARGS, | | | | | | FLAGS, | | | | | | VISIBILITY, | | | | | | PARAM, | | | | | | HELPTEXT, | | | | | | HELPTEXTSFORVARIANTS, | | | | | | METAVAR, | | | | | | VALUES, | | | | | | SHOULD_PARSE, | | | | | | ALWAYS_EMIT, | | | | | | KEYPATH, | | | | | | DEFAULT_VALUE, | | | | | | IMPLIED_CHECK, | | | | | | IMPLIED_VALUE, | | | | | | NORMALIZER, | | | | | | DENORMALIZER, | | | | | | MERGER, | | | | | | EXTRACTOR, | | | | | | TABLE_INDEX | | | | | ) | | | |

Value:

KEYPATH = MERGER(KEYPATH, DEFAULT_VALUE); \

if (IMPLIED_CHECK) \

KEYPATH = MERGER(KEYPATH, IMPLIED_VALUE); \

if (SHOULD_PARSE) \

if (auto MaybeValue = NORMALIZER(OPT_##ID, TABLE_INDEX, ARGS, DIAGS)) \

KEYPATH = \

MERGER(KEYPATH, static_cast<decltype(KEYPATH)>(*MaybeValue)); \

}

Definition at line 556 of file CompilerInvocation.cpp.

PREPROCESSOR_OPTION_WITH_MARSHALLING [1/2]

PREPROCESSOR_OPTION_WITH_MARSHALLING [2/2]

PREPROCESSOR_OUTPUT_OPTION_WITH_MARSHALLING [1/2]

PREPROCESSOR_OUTPUT_OPTION_WITH_MARSHALLING [2/2]

SIMPLE_ENUM_VALUE_TABLE

#define SIMPLE_ENUM_VALUE_TABLE

TARGET_OPTION_WITH_MARSHALLING [1/2]

TARGET_OPTION_WITH_MARSHALLING [2/2]

VALUE_DEBUGOPT

| #define VALUE_DEBUGOPT | ( | | Name, | | ----------------------- | -------------------------------- | | ----- | | | Bits, | | | | | | Default | | | | | ) | HBuilder.add(CodeGenOpts->Name); | | |

ArgumentConsumer

GenerateFn

ParseFn

addDiagnosticArgs()

static void addDiagnosticArgs ( ArgList & Args, OptSpecifier Group, OptSpecifier GroupWithValue, std::vector< std::string > & Diagnostics ) static

checkVerifyPrefixes()

static bool checkVerifyPrefixes ( const std::vector< std::string > & VerifyPrefixes, DiagnosticsEngine & Diags ) static

denormalizeSimpleEnum()

denormalizeSimpleEnumImpl()

denormalizeSimpleFlag() [1/2]

static void denormalizeSimpleFlag ( ArgumentConsumer Consumer, const Twine & Spelling, Option::OptionClass , unsigned , ... ) static

denormalizeSimpleFlag() [2/2]

The tblgen-erated code passes in a fifth parameter of an arbitrary type, but denormalizeSimpleFlags never looks at it.

Avoid bloating compile-time with unnecessary template instantiations and just ignore it with a variadic argument.

Definition at line 314 of file CompilerInvocation.cpp.

References lookupStrInTable().

Referenced by GenerateArg().

denormalizeString() [1/2]

template

static void denormalizeString ( ArgumentConsumer Consumer, const Twine & Spelling, Option::OptionClass OptClass, unsigned TableIndex, T Value ) static

denormalizeString() [2/2]

denormalizeStringImpl()

static void denormalizeStringImpl ( ArgumentConsumer Consumer, const Twine & Spelling, Option::OptionClass OptClass, unsigned , const Twine & Value ) static

denormalizeStringVector()

static void denormalizeStringVector ( ArgumentConsumer Consumer, unsigned SpellingOffset, Option::OptionClass OptClass, unsigned TableIndex, const std::vector< std::string > & Values ) static

extractForwardValue()

template

static T extractForwardValue ( T KeyPath) static

extractMaskValue()

template<typename T , typename U , U Value>

static T extractMaskValue ( T KeyPath) static

findValueTableByName()

static std::optional< SimpleEnumValue > findValueTableByName ( const SimpleEnumValueTable & Table, StringRef Name ) static

findValueTableByValue()

static std::optional< SimpleEnumValue > findValueTableByValue ( const SimpleEnumValueTable & Table, unsigned Value ) static

FixupInvocation()

Definition at line 592 of file CompilerInvocation.cpp.

References bool, clang::CodeGenOptions::CodeModel, clang::TargetOptions::CodeModel, clang::LangOptions::CurrentModule, clang::LangOptionsBase::DCC_FastCall, clang::LangOptionsBase::DCC_RegCall, clang::LangOptionsBase::DCC_RtdCall, clang::LangOptionsBase::DCC_StdCall, clang::LangOptionsBase::DCC_VectorCall, clang::FrontendOptions::DisableFree, clang::FrontendOptions::GenerateGlobalModuleIndex, clang::CompilerInvocation::getCodeGenOpts(), clang::CompilerInvocation::getFrontendOpts(), GetInputKindName(), clang::CompilerInvocation::getLangOpts(), clang::DiagnosticsEngine::getNumErrors(), clang::LangOptions::getOpenCLCompatibleVersion(), clang::LangOptions::getOpenCLVersionString(), clang::CompilerInvocation::getTargetOpts(), clang::CodeGenOptions::hasSanitizeCoverage(), clang::CodeGenOptions::LargeDataThreshold, clang::TargetOptions::LargeDataThreshold, clang::LangOptions::ModuleName, clang::LangOptionsBase::None, clang::DiagnosticsEngine::Report(), clang::LangOptions::SanitizeCoverage, clang::FrontendOptions::ShowStats, clang::T, clang::TargetOptions::Triple, and clang::FrontendOptions::UseGlobalModuleIndex.

GenerateAnalyzerArgs()

GenerateAPINotesArgs()

GenerateArg() [1/2]

static void GenerateArg ( ArgumentConsumer Consumer, llvm::opt::OptSpecifier OptSpecifier ) static

Definition at line 763 of file CompilerInvocation.cpp.

References denormalizeSimpleFlag(), and clang::driver::getDriverOptTable().

Referenced by GenerateAnalyzerArgs(), GenerateAPINotesArgs(), GenerateDependencyOutputArgs(), GenerateFrontendArgs(), GenerateHeaderSearchArgs(), GenerateOptimizationRemark(), GeneratePointerAuthArgs(), GeneratePreprocessorArgs(), GeneratePreprocessorOutputArgs(), and GenerateTargetArgs().

GenerateArg() [2/2]

static void GenerateArg ( ArgumentConsumer Consumer, llvm::opt::OptSpecifier OptSpecifier, const Twine & Value ) static

GenerateDependencyOutputArgs()

GenerateFileSystemArgs()

GenerateFrontendArgs()

Definition at line 2788 of file CompilerInvocation.cpp.

References clang::FrontendOptions::ActionName, clang::ADOF_Default, clang::ADOF_JSON, clang::Asm, clang::frontend::ASTDump, clang::FrontendOptions::ASTDumpAll, clang::FrontendOptions::ASTDumpDecls, clang::FrontendOptions::ASTDumpFormat, clang::FrontendOptions::AuxTargetCPU, clang::FrontendOptions::AuxTargetFeatures, clang::C, clang::CIR, clang::FrontendOptions::CodeCompletionAt, clang::CUDA, clang::CXX, clang::FrontendOptions::DashX, denormalizeString(), clang::ParsedSourceLocation::FileName, clang::frontend::FixIt, clang::FrontendOptions::FixItSuffix, GenerateArg(), clang::driver::getDriverOptTable(), clang::InputKind::getFormat(), clang::InputKind::getHeaderUnitKind(), clang::InputKind::getLanguage(), getProgramActionOpt(), clang::InputKind::HeaderUnit_Abs, clang::InputKind::HeaderUnit_None, clang::InputKind::HeaderUnit_System, clang::InputKind::HeaderUnit_User, clang::HIP, clang::HLSL, clang::FrontendOptions::Inputs, clang::InputKind::isPreprocessed(), clang::LLVM_IR, clang::FrontendOptions::ModuleFileExtensions, clang::FrontendOptions::ModuleFiles, clang::InputKind::ModuleMap, clang::ObjC, clang::ObjCXX, clang::OpenCL, clang::OpenCLCXX, clang::frontend::PluginAction, clang::FrontendOptions::PluginArgs, clang::FrontendOptions::Plugins, clang::InputKind::Precompiled, clang::FrontendOptions::ProgramAction, clang::ParsedSourceLocation::ToString(), and clang::Unknown.

Referenced by clang::CompilerInvocationBase::generateCC1CommandLine().

GenerateHeaderSearchArgs()

Definition at line 3236 of file CompilerInvocation.cpp.

References clang::frontend::After, clang::frontend::Angled, clang::frontend::CSystem, clang::frontend::CXXSystem, clang::frontend::ExternCSystem, clang::File, GenerateArg(), clang::HeaderSearchOptions::Entry::Group, clang::HeaderSearchOptions::Entry::IgnoreSysRoot, clang::HeaderSearchOptions::Entry::IsFramework, clang::HeaderSearchOptions::ModuleCachePath, clang::HeaderSearchOptions::ModulesIgnoreMacros, clang::frontend::ObjCSystem, clang::frontend::ObjCXXSystem, P, Path, clang::HeaderSearchOptions::PrebuiltModuleFiles, clang::HeaderSearchOptions::PrebuiltModulePaths, clang::frontend::Quoted, clang::frontend::System, clang::HeaderSearchOptions::SystemHeaderPrefixes, clang::HeaderSearchOptions::UseLibcxx, clang::HeaderSearchOptions::UserEntries, and clang::HeaderSearchOptions::VFSOverlayFiles.

Referenced by clang::CompilerInvocationBase::generateCC1CommandLine().

GenerateMigratorArgs()

GenerateOptimizationRemark()

GeneratePointerAuthArgs()

GeneratePreprocessorArgs()

Definition at line 4655 of file CompilerInvocation.cpp.

References clang::PreprocessorOptions::ChainedIncludes, D, clang::PreprocessorOptions::DefineTargetOSMacros, clang::PreprocessorOptions::DeserializedPCHDeclsToErrorOn, clang::PreprocessorOptions::EmbedEntries, GenerateArg(), clang::PreprocessorOptions::Includes, clang::PreprocessorOptions::Macros, clang::PreprocessorOptions::PCHWithHdrStop, clang::PreprocessorOptions::PCHWithHdrStopCreate, clang::PreprocessorOptions::PrecompiledPreambleBytes, clang::PreprocessorOptions::RemappedFiles, and clang::PreprocessorOptions::SourceDateEpoch.

Referenced by clang::CompilerInvocationBase::generateCC1CommandLine().

GeneratePreprocessorOutputArgs()

GenerateTargetArgs()

getAllNoBuiltinFuncValues()

static void getAllNoBuiltinFuncValues ( ArgList & Args, std::vector< std::string > & Funcs ) static

getFrontendAction()

getFrontendActionTable()

static const auto & getFrontendActionTable ( ) static

Return a table that associates command line option specifiers with the frontend action.

Note: The pair {frontend::PluginAction, OPT_plugin} is intentionally missing, as this case is handled separately from other frontend options.

Definition at line 2712 of file CompilerInvocation.cpp.

References clang::frontend::ASTDeclList, clang::frontend::ASTDump, clang::frontend::ASTPrint, clang::frontend::ASTView, clang::frontend::DumpCompilerOptions, clang::frontend::DumpRawTokens, clang::frontend::DumpTokens, clang::frontend::EmitAssembly, clang::frontend::EmitBC, clang::frontend::EmitCIR, clang::frontend::EmitCodeGenOnly, clang::frontend::EmitHTML, clang::frontend::EmitLLVM, clang::frontend::EmitLLVMOnly, clang::frontend::EmitObj, clang::frontend::ExtractAPI, clang::frontend::FixIt, clang::frontend::GenerateHeaderUnit, clang::frontend::GenerateInterfaceStubs, clang::frontend::GenerateModule, clang::frontend::GenerateModuleInterface, clang::frontend::GeneratePCH, clang::frontend::GenerateReducedModuleInterface, clang::frontend::InitOnly, clang::frontend::MigrateSource, clang::frontend::ModuleFileInfo, clang::frontend::ParseSyntaxOnly, clang::frontend::PrintDependencyDirectivesSourceMinimizerOutput, clang::frontend::PrintPreamble, clang::frontend::PrintPreprocessedInput, clang::frontend::RewriteMacros, clang::frontend::RewriteObjC, clang::frontend::RewriteTest, clang::frontend::RunAnalysis, clang::frontend::RunPreprocessorOnly, clang::frontend::TemplightDump, and clang::frontend::VerifyPCH.

Referenced by getFrontendAction(), and getProgramActionOpt().

GetInputKindName()

static StringRef GetInputKindName ( InputKind IK) static

Get language name for given input kind.

Definition at line 3600 of file CompilerInvocation.cpp.

References clang::Asm, clang::C, clang::CIR, clang::CUDA, clang::CXX, clang::InputKind::getLanguage(), clang::HIP, clang::HLSL, clang::LLVM_IR, clang::ObjC, clang::ObjCXX, clang::OpenCL, clang::OpenCLCXX, and clang::Unknown.

Referenced by FixupInvocation().

getOptimizationLevel()

getOptimizationLevelSize()

static unsigned getOptimizationLevelSize ( ArgList & Args) static

getProgramActionOpt()

static std::optional< OptSpecifier > getProgramActionOpt ( frontend::ActionKind ProgramAction) static

getStringOption()

initOption() [1/4]

initOption() [2/4]

initOption() [3/4]

initOption() [4/4]

is_uint64_t_convertible()

template

static constexpr bool is_uint64_t_convertible ( ) staticconstexpr

IsInputCompatibleWithStandard()

Check if input file kind and language standard are compatible.

Definition at line 3555 of file CompilerInvocation.cpp.

References clang::Asm, clang::C, clang::CIR, clang::CUDA, clang::CXX, clang::InputKind::getLanguage(), clang::HIP, clang::HLSL, clang::LLVM_IR, clang::ObjC, clang::ObjCXX, clang::OpenCL, clang::OpenCLCXX, and clang::Unknown.

isStrictlyPreprocessorAction()

Definition at line 4608 of file CompilerInvocation.cpp.

References clang::frontend::ASTDeclList, clang::frontend::ASTDump, clang::frontend::ASTPrint, clang::frontend::ASTView, clang::frontend::DumpCompilerOptions, clang::frontend::DumpRawTokens, clang::frontend::DumpTokens, clang::frontend::EmitAssembly, clang::frontend::EmitBC, clang::frontend::EmitCIR, clang::frontend::EmitCodeGenOnly, clang::frontend::EmitHTML, clang::frontend::EmitLLVM, clang::frontend::EmitLLVMOnly, clang::frontend::EmitObj, clang::frontend::ExtractAPI, clang::frontend::FixIt, clang::frontend::GenerateHeaderUnit, clang::frontend::GenerateInterfaceStubs, clang::frontend::GenerateModule, clang::frontend::GenerateModuleInterface, clang::frontend::GeneratePCH, clang::frontend::GenerateReducedModuleInterface, clang::frontend::InitOnly, clang::frontend::MigrateSource, clang::frontend::ModuleFileInfo, clang::frontend::ParseSyntaxOnly, clang::frontend::PluginAction, clang::frontend::PrintDependencyDirectivesSourceMinimizerOutput, clang::frontend::PrintPreamble, clang::frontend::PrintPreprocessedInput, clang::frontend::RewriteMacros, clang::frontend::RewriteObjC, clang::frontend::RewriteTest, clang::frontend::RunAnalysis, clang::frontend::RunPreprocessorOnly, clang::frontend::TemplightDump, and clang::frontend::VerifyPCH.

Referenced by GeneratePreprocessorOutputArgs(), ParsePreprocessorArgs(), and ParsePreprocessorOutputArgs().

lookupStrInTable()

static llvm::StringRef lookupStrInTable ( unsigned Offset) static

makeBooleanOptionDenormalizer()

static auto makeBooleanOptionDenormalizer ( bool Value) static

makeBooleanOptionNormalizer()

static auto makeBooleanOptionNormalizer ( bool Value, bool OtherValue, OptSpecifier OtherOpt ) static

makeFlagToValueNormalizer()

static auto makeFlagToValueNormalizer ( T Value) static

mergeForwardValue()

template<typename T , typename U >

static T mergeForwardValue ( T KeyPath, U Value ) static

mergeMaskValue()

template<typename T , typename U >

static T mergeMaskValue ( T KeyPath, U Value ) static

normalizeSimpleEnum()

normalizeSimpleFlag()

static std::optional< bool > normalizeSimpleFlag ( OptSpecifier Opt, unsigned TableIndex, const ArgList & Args, DiagnosticsEngine & Diags ) static

normalizeSimpleNegativeFlag()

normalizeString()

static std::optional< std::string > normalizeString ( OptSpecifier Opt, int TableIndex, const ArgList & Args, DiagnosticsEngine & Diags ) static

normalizeStringIntegral()

template

static std::optional< IntTy > normalizeStringIntegral ( OptSpecifier Opt, int , const ArgList & Args, DiagnosticsEngine & Diags ) static

normalizeStringVector()

static std::optional< std::vector< std::string > > normalizeStringVector ( OptSpecifier Opt, int , const ArgList & Args, DiagnosticsEngine & ) static

normalizeTriple()

static std::optional< std::string > normalizeTriple ( OptSpecifier Opt, int TableIndex, const ArgList & Args, DiagnosticsEngine & Diags ) static

ParseAnalyzerArgs()

Definition at line 1073 of file CompilerInvocation.cpp.

References clang::AnalyzerOptions::AnalysisConstraintsOpt, clang::AnalyzerOptions::AnalysisDiagOpt, clang::AnalyzerOptions::AnalysisPurgeOpt, clang::AnalyzerOptions::CheckersAndPackages, clang::AnalyzerOptions::Config, clang::AnalyzerOptions::FullCompilerInvocation, clang::DiagnosticsEngine::getNumErrors(), clang::AnalyzerOptions::InliningMode, clang::AnalyzerOptions::isUnknownAnalyzerConfig(), clang::NUM_ANALYSIS_DIAG_CLIENTS, clang::NumConstraints, clang::NumInliningModes, clang::NumPurgeModes, parseAnalyzerConfigs(), clang::DiagnosticsEngine::Report(), and clang::AnalyzerOptions::ShouldEmitErrorsOnInvalidConfigValue.

parseAnalyzerConfigs()

ParseAPINotesArgs()

ParseDependencyOutputArgs()

Definition at line 2367 of file CompilerInvocation.cpp.

References clang::EDK_DepFileEntry, clang::EDK_ModuleFile, clang::EDK_ProfileList, clang::EDK_SanitizeIgnorelist, clang::DependencyOutputOptions::ExtraDeps, Filename, clang::DiagnosticsEngine::getNumErrors(), clang::DependencyOutputOptions::HeaderIncludeFiltering, clang::DependencyOutputOptions::HeaderIncludeFormat, clang::HIFIL_None, clang::HIFIL_Only_Direct_System, clang::HIFMT_JSON, clang::HIFMT_Textual, clang::DependencyOutputOptions::IncludeSystemHeaders, clang::None, clang::frontend::PrintPreprocessedInput, clang::DiagnosticsEngine::Report(), clang::DependencyOutputOptions::ShowIncludesDest, clang::Stderr, and clang::Stdout.

parseDiagnosticLevelMask()

ParseFileSystemArgs()

ParseFrontendArgs()

Definition at line 2955 of file CompilerInvocation.cpp.

References clang::FrontendOptions::ActionName, clang::ADOF_Default, clang::ADOF_JSON, clang::FrontendOptions::ARCMT_None, clang::FrontendOptions::ARCMTAction, clang::Asm, clang::frontend::ASTDump, clang::FrontendOptions::ASTDumpAll, clang::FrontendOptions::ASTDumpDecls, clang::FrontendOptions::ASTDumpFormat, clang::FrontendOptions::AuxTargetCPU, clang::FrontendOptions::AuxTargetFeatures, clang::C, clang::CIR, clang::FrontendOptions::CodeCompletionAt, clang::CUDA, clang::CXX, clang::FrontendOptions::DashX, clang::ParsedSourceLocation::FileName, clang::frontend::FixIt, clang::FrontendOptions::FixItSuffix, clang::ParsedSourceLocation::FromString(), clang::frontend::GenerateInterfaceStubs, clang::frontend::GenerateModule, clang::InputKind::getFormat(), getFrontendAction(), clang::InputKind::getHeader(), clang::InputKind::getHeaderUnitKind(), clang::FrontendOptions::getInputKindForExtension(), clang::DiagnosticsEngine::getNumErrors(), clang::InputKind::getPreprocessed(), clang::InputKind::HeaderUnit_Abs, clang::InputKind::HeaderUnit_None, clang::InputKind::HeaderUnit_System, clang::InputKind::HeaderUnit_User, clang::HIP, clang::HLSL, clang::FrontendOptions::Inputs, clang::FrontendOptions::IsSystemModule, clang::InputKind::isUnknown(), clang::LLVM_IR, clang::FrontendOptions::ModuleFileExtensions, clang::FrontendOptions::ModuleFiles, clang::InputKind::ModuleMap, clang::ObjC, clang::FrontendOptions::ObjCMT_None, clang::FrontendOptions::ObjCMTAction, clang::ObjCXX, clang::OpenCL, clang::OpenCLCXX, clang::frontend::ParseSyntaxOnly, parseTestModuleFileExtensionArg(), clang::frontend::PluginAction, clang::FrontendOptions::PluginArgs, clang::FrontendOptions::Plugins, clang::InputKind::Precompiled, clang::FrontendOptions::ProgramAction, clang::DiagnosticsEngine::Report(), clang::InputKind::Source, clang::Unknown, clang::FrontendOptions::UseClangIRPipeline, clang::InputKind::withFormat(), and clang::InputKind::withHeaderUnit().

ParseHeaderSearchArgs()

Definition at line 3349 of file CompilerInvocation.cpp.

References clang::HeaderSearchOptions::AddPath(), clang::HeaderSearchOptions::AddPrebuiltModulePath(), clang::HeaderSearchOptions::AddSystemHeaderPrefix(), clang::HeaderSearchOptions::AddVFSOverlayFile(), clang::frontend::After, clang::frontend::Angled, clang::frontend::CSystem, clang::frontend::CXXSystem, clang::frontend::ExternCSystem, clang::DiagnosticsEngine::getNumErrors(), clang::HeaderSearchOptions::ModuleCachePath, clang::HeaderSearchOptions::ModulesIgnoreMacros, clang::frontend::ObjCSystem, clang::frontend::ObjCXXSystem, P, clang::HeaderSearchOptions::PrebuiltModuleFiles, clang::frontend::Quoted, clang::HeaderSearchOptions::Sysroot, clang::frontend::System, and clang::HeaderSearchOptions::UseLibcxx.

ParseMigratorArgs()

ParseOptimizationRemark()

ParsePointerAuthArgs()

parsePointerAuthOptions()

ParsePreprocessorArgs()

Definition at line 4728 of file CompilerInvocation.cpp.

References clang::PreprocessorOptions::addMacroDef(), clang::PreprocessorOptions::addMacroUndef(), clang::PreprocessorOptions::addRemappedFile(), clang::PreprocessorOptions::ChainedIncludes, clang::PreprocessorOptions::DefineTargetOSMacros, clang::PreprocessorOptions::DeserializedPCHDeclsToErrorOn, clang::PreprocessorOptions::EmbedEntries, clang::DiagnosticsEngine::getNumErrors(), clang::PreprocessorOptions::Includes, isStrictlyPreprocessorAction(), clang::PreprocessorOptions::LexEditorPlaceholders, clang::PreprocessorOptions::PCHWithHdrStop, clang::PreprocessorOptions::PrecompiledPreambleBytes, clang::DiagnosticsEngine::Report(), clang::PreprocessorOptions::SourceDateEpoch, and V.

ParsePreprocessorOutputArgs()

parseSanitizerKinds()

static void parseSanitizerKinds ( StringRef FlagName, const std::vector< std::string > & Sanitizers, DiagnosticsEngine & Diags, SanitizerSet & S ) static

parseSanitizerWeightedKinds()

parseShowColorsArgs()

static bool parseShowColorsArgs ( const ArgList & Args, bool DefaultColor ) static

ParseTargetArgs()

parseTestModuleFileExtensionArg()

static bool parseTestModuleFileExtensionArg ( StringRef Arg, std::string & BlockName, unsigned & MajorVersion, unsigned & MinorVersion, bool & Hashed, std::string & UserInfo ) static

parseToleranceOption()

static Expected< std::optional< uint32_t > > parseToleranceOption ( StringRef Arg) static

parseXRayInstrumentationBundle()

static void parseXRayInstrumentationBundle ( StringRef FlagName, StringRef Bundle, ArgList & Args, DiagnosticsEngine & D, XRayInstrSet & S ) static

RoundTrip()

May perform round-trip of command line arguments.

By default, the round-trip is enabled in assert builds. This can be overwritten at run-time via the "-round-trip-args" and "-no-round-trip-args" command line flags, or via the ForceRoundTrip parameter.

During round-trip, the command line arguments are parsed into a dummy CompilerInvocation, which is used to generate the command line arguments again. The real CompilerInvocation is then created by parsing the generated arguments, not the original ones. This (in combination with tests covering argument behavior) ensures the generated command line is complete (doesn't drop/mangle any arguments).

Finally, we check the command line that was used to create the real CompilerInvocation instance. By default, we compare it to the command line the real CompilerInvocation generates. This checks whether the generator is deterministic. If CheckAgainstOriginalInvocation is enabled, we instead compare it to the original command line to verify the original command-line was canonical and can round-trip exactly.

Definition at line 805 of file CompilerInvocation.cpp.

References clang::Equal, clang::DiagnosticsEngine::getNumWarnings(), clang::DiagnosticsEngine::Report(), clang::DiagnosticsEngine::setClient(), and clang::Success.

Referenced by clang::CompilerInvocation::checkCC1RoundTrip(), and clang::CompilerInvocation::CreateFromArgs().

serializeSanitizerKinds()

serializeXRayInstrumentationBundle()

static std::string serializeXRayInstrumentationBundle ( const XRayInstrSet & S) static

setPGOUseInstrumentor()