clang 22.0.0git
CompilerInvocation.cpp File Reference
#include "clang/Frontend/CompilerInvocation.h"
#include "TestModuleFileExtension.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/CodeGenOptions.h"
#include "clang/Basic/CommentOptions.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticDriver.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/FileSystemOptions.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/LangStandard.h"
#include "clang/Basic/ObjCRuntime.h"
#include "clang/Basic/Sanitizers.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/TargetOptions.h"
#include "clang/Basic/Version.h"
#include "clang/Basic/XRayInstr.h"
#include "clang/Config/config.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/Options.h"
#include "clang/Frontend/CommandLineSourceLoc.h"
#include "clang/Frontend/DependencyOutputOptions.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Frontend/FrontendOptions.h"
#include "clang/Frontend/MigratorOptions.h"
#include "clang/Frontend/PreprocessorOutputOptions.h"
#include "clang/Frontend/TextDiagnosticBuffer.h"
#include "clang/Frontend/Utils.h"
#include "clang/Lex/HeaderSearchOptions.h"
#include "clang/Lex/PreprocessorOptions.h"
#include "clang/Serialization/ASTBitCodes.h"
#include "clang/Serialization/ModuleFileExtension.h"
#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/CachedHashString.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/ADT/STLExtras.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 <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/ABIVersions.def"
#include "clang/Basic/LangStandards.def"
#include "clang/Basic/LangOptions.def"
#include "clang/Basic/DiagnosticOptions.def"
#include "clang/Basic/CodeGenOptions.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(...)
#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(...)
#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(TYPE, NAME, CMDFLAG, DESC, 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(...)
#define CF_BRANCH_LABEL_SCHEME(Kind, FlagVal)
#define CODEGEN_OPTION_WITH_MARSHALLING(...)
#define CF_BRANCH_LABEL_SCHEME(Kind, FlagVal)
#define DEPENDENCY_OUTPUT_OPTION_WITH_MARSHALLING(...)
#define DEPENDENCY_OUTPUT_OPTION_WITH_MARSHALLING(...)
#define FILE_SYSTEM_OPTION_WITH_MARSHALLING(...)
#define FILE_SYSTEM_OPTION_WITH_MARSHALLING(...)
#define MIGRATOR_OPTION_WITH_MARSHALLING(...)
#define MIGRATOR_OPTION_WITH_MARSHALLING(...)
#define DIAG_OPTION_WITH_MARSHALLING(...)
#define DIAG_OPTION_WITH_MARSHALLING(...)
#define FRONTEND_OPTION_WITH_MARSHALLING(...)
#define FRONTEND_OPTION_WITH_MARSHALLING(...)
#define HEADER_SEARCH_OPTION_WITH_MARSHALLING(...)
#define HEADER_SEARCH_OPTION_WITH_MARSHALLING(...)
#define LANG_OPTION_WITH_MARSHALLING(...)
#define ABI_VER_MAJOR_MINOR(Major, Minor)
#define ABI_VER_MAJOR(Major)
#define ABI_VER_LATEST(Latest)
#define LANGSTANDARD(id, name, lang, desc, features)
#define LANGSTANDARD_ALIAS(id, alias)
#define LANGSTANDARD_ALIAS_DEPR(id, alias)
#define LANGSTANDARD(id, name, lang, desc, features)
#define LANGSTANDARD_ALIAS(id, alias)
#define LANGSTANDARD_ALIAS_DEPR(id, alias)
#define LANG_OPTION_WITH_MARSHALLING(...)
#define CF_BRANCH_LABEL_SCHEME(Kind, FlagVal)
#define ABI_VER_MAJOR_MINOR(Major_, Minor_)
#define ABI_VER_MAJOR(Major_)
#define ABI_VER_LATEST(Latest)
#define PREPROCESSOR_OPTION_WITH_MARSHALLING(...)
#define PREPROCESSOR_OPTION_WITH_MARSHALLING(...)
#define PREPROCESSOR_OUTPUT_OPTION_WITH_MARSHALLING(...)
#define PREPROCESSOR_OUTPUT_OPTION_WITH_MARSHALLING(...)
#define TARGET_OPTION_WITH_MARSHALLING(...)
#define TARGET_OPTION_WITH_MARSHALLING(...)
#define LANGOPT(Name, Bits, Default, Compatibility, Description)
#define ENUM_LANGOPT(Name, Type, Bits, Default, Compatibility, Description)
#define DIAGOPT(Name, Bits, Default)
#define ENUM_DIAGOPT(Name, Type, Bits, Default)
#define CODEGENOPT(Name, Bits, Default, Compatibility)
#define ENUM_CODEGENOPT(Name, Type, Bits, Default, Compatibility)
#define DEBUGOPT(Name, Bits, Default, Compatibility)
#define VALUE_DEBUGOPT(Name, Bits, Default, Compatibility)
#define ENUM_DEBUGOPT(Name, Type, Bits, Default, Compatibility)
#define DEBUGOPT(Name, Bits, Default, Compatibility)
#define VALUE_DEBUGOPT(Name, Bits, Default, Compatibility)
#define ENUM_DEBUGOPT(Name, Type, Bits, Default, Compatibility)

Typedefs

using ArgumentConsumer = CompilerInvocation::ArgumentConsumer
using ParseFn
using GenerateFn

Functions

static Expected< std::optional< uint32_t > > parseToleranceOption (StringRef Arg)
template<class T>
std::shared_ptr< T > make_shared_copy (const T &X)
template<typename T>
T & ensureOwned (std::shared_ptr< T > &Storage)
static llvm::StringRef lookupStrInTable (unsigned Offset)
static std::optional< boolnormalizeSimpleFlag (OptSpecifier Opt, unsigned TableIndex, const ArgList &Args, DiagnosticsEngine &Diags)
static std::optional< boolnormalizeSimpleNegativeFlag (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<typename T>
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)
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<typename T>
static void denormalizeString (ArgumentConsumer Consumer, unsigned SpellingOffset, Option::OptionClass OptClass, unsigned TableIndex, T Value)
template<typename T>
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< unsignednormalizeSimpleEnum (OptSpecifier Opt, unsigned TableIndex, const ArgList &Args, DiagnosticsEngine &Diags)
static void denormalizeSimpleEnumImpl (ArgumentConsumer Consumer, unsigned SpellingOffset, Option::OptionClass OptClass, unsigned TableIndex, unsigned Value)
template<typename T>
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<typename IntTy>
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<typename T>
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::ActionKindgetFrontendAction (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 bool isCodeGenAction (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)

Macro Definition Documentation

◆ ABI_VER_LATEST [1/2]

#define ABI_VER_LATEST ( Latest)
Value:
case LangOptions::ClangABI::Latest: \
break;

◆ ABI_VER_LATEST [2/2]

#define ABI_VER_LATEST ( Latest)
Value:
{ /* Equivalent to latest version - do nothing */ \
}

◆ ABI_VER_MAJOR [1/2]

#define ABI_VER_MAJOR ( Major)
Value:
case LangOptions::ClangABI::Ver##Major: \
GenerateArg(Consumer, OPT_fclang_abi_compat_EQ, #Major ".0"); \
break;

◆ ABI_VER_MAJOR [2/2]

#define ABI_VER_MAJOR ( Major_)
Value:
if (Major <= Major_) \
Opts.setClangABICompat(LangOptions::ClangABI::Ver##Major_); \
else

◆ ABI_VER_MAJOR_MINOR [1/2]

#define ABI_VER_MAJOR_MINOR ( Major,
Minor )
Value:
case LangOptions::ClangABI::Ver##Major##_##Minor: \
GenerateArg(Consumer, OPT_fclang_abi_compat_EQ, #Major "." #Minor); \
break;

◆ ABI_VER_MAJOR_MINOR [2/2]

#define ABI_VER_MAJOR_MINOR ( Major_,
Minor_ )
Value:
if (std::tuple(Major, Minor) <= std::tuple(Major_, Minor_)) \
Opts.setClangABICompat(LangOptions::ClangABI::Ver##Major_##_##Minor_); \
else

◆ 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 )
Value:
.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 )
Value:
.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 )
Value:
.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 )
Value:
.Case(CMDFLAG, NAME)

◆ ANALYZER_OPTION [1/2]

#define ANALYZER_OPTION ( ...)

◆ ANALYZER_OPTION [2/2]

#define ANALYZER_OPTION ( TYPE,
NAME,
CMDFLAG,
DESC,
DEFAULT_VAL )
Value:
initOption(AnOpts.Config, Diags, AnOpts.NAME, CMDFLAG, DEFAULT_VAL);
static void initOption(AnalyzerOptions::ConfigTable &Config, DiagnosticsEngine *Diags, StringRef &OptionField, StringRef Name, StringRef DefaultVal)

◆ 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);

◆ ANALYZER_OPTION_WITH_MARSHALLING [1/2]

#define ANALYZER_OPTION_WITH_MARSHALLING ( ...)
Value:
GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)
#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)

◆ ANALYZER_OPTION_WITH_MARSHALLING [2/2]

#define ANALYZER_OPTION_WITH_MARSHALLING ( ...)
Value:
PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)
#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)

◆ 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]

#define CF_BRANCH_LABEL_SCHEME ( Kind,
FlagVal )
Value:
.Case(#FlagVal, CFBranchLabelSchemeKind::Kind)

◆ CF_BRANCH_LABEL_SCHEME [3/3]

#define CF_BRANCH_LABEL_SCHEME ( Kind,
FlagVal )
Value:
.Case(#FlagVal, CFBranchLabelSchemeKind::Kind)

◆ CODEGEN_OPTION_WITH_MARSHALLING [1/2]

#define CODEGEN_OPTION_WITH_MARSHALLING ( ...)
Value:
GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)

◆ CODEGEN_OPTION_WITH_MARSHALLING [2/2]

#define CODEGEN_OPTION_WITH_MARSHALLING ( ...)
Value:
PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)

◆ CODEGENOPT

#define CODEGENOPT ( Name,
Bits,
Default,
Compatibility )
Value:
if constexpr (CK::Compatibility != CK::Benign) \
HBuilder.add(CodeGenOpts->Name);

◆ DEBUGOPT [1/2]

#define DEBUGOPT ( Name,
Bits,
Default,
Compatibility )

◆ DEBUGOPT [2/2]

#define DEBUGOPT ( Name,
Bits,
Default,
Compatibility )
Value:
if constexpr (CK::Compatibility != CK::Benign) \
HBuilder.add(CodeGenOpts->Name);

◆ DEPENDENCY_OUTPUT_OPTION_WITH_MARSHALLING [1/2]

#define DEPENDENCY_OUTPUT_OPTION_WITH_MARSHALLING ( ...)
Value:
GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)

◆ DEPENDENCY_OUTPUT_OPTION_WITH_MARSHALLING [2/2]

#define DEPENDENCY_OUTPUT_OPTION_WITH_MARSHALLING ( ...)
Value:
PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)

◆ DIAG_OPTION_WITH_MARSHALLING [1/2]

#define DIAG_OPTION_WITH_MARSHALLING ( ...)
Value:
GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)

◆ DIAG_OPTION_WITH_MARSHALLING [2/2]

#define DIAG_OPTION_WITH_MARSHALLING ( ...)
Value:
PARSE_OPTION_WITH_MARSHALLING(Args, *Diags, __VA_ARGS__)

◆ DIAGOPT

#define DIAGOPT ( Name,
Bits,
Default )
Value:
HBuilder.add(diagOpts.Name);

◆ ENUM_CODEGENOPT

#define ENUM_CODEGENOPT ( Name,
Type,
Bits,
Default,
Compatibility )
Value:
if constexpr (CK::Compatibility != CK::Benign) \
HBuilder.add(static_cast<unsigned>(CodeGenOpts->get##Name()));

◆ ENUM_DEBUGOPT [1/2]

#define ENUM_DEBUGOPT ( Name,
Type,
Bits,
Default,
Compatibility )

◆ ENUM_DEBUGOPT [2/2]

#define ENUM_DEBUGOPT ( Name,
Type,
Bits,
Default,
Compatibility )
Value:
if constexpr (CK::Compatibility != CK::Benign) \
HBuilder.add(static_cast<unsigned>(CodeGenOpts->get##Name()));

◆ ENUM_DIAGOPT

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

◆ ENUM_LANGOPT

#define ENUM_LANGOPT ( Name,
Type,
Bits,
Default,
Compatibility,
Description )
Value:
if constexpr (CK::Compatibility != CK::Benign) \
HBuilder.add(static_cast<unsigned>(LangOpts->get##Name()));

◆ FILE_SYSTEM_OPTION_WITH_MARSHALLING [1/2]

#define FILE_SYSTEM_OPTION_WITH_MARSHALLING ( ...)
Value:
GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)

◆ FILE_SYSTEM_OPTION_WITH_MARSHALLING [2/2]

#define FILE_SYSTEM_OPTION_WITH_MARSHALLING ( ...)
Value:
PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)

◆ FRONTEND_OPTION_WITH_MARSHALLING [1/2]

#define FRONTEND_OPTION_WITH_MARSHALLING ( ...)
Value:
GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)

◆ FRONTEND_OPTION_WITH_MARSHALLING [2/2]

#define FRONTEND_OPTION_WITH_MARSHALLING ( ...)
Value:
PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)

◆ 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:
if ((VISIBILITY) & options::CC1Option) { \
[&](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 551 of file CompilerInvocation.cpp.

◆ HEADER_SEARCH_OPTION_WITH_MARSHALLING [1/2]

#define HEADER_SEARCH_OPTION_WITH_MARSHALLING ( ...)
Value:
GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)

◆ HEADER_SEARCH_OPTION_WITH_MARSHALLING [2/2]

#define HEADER_SEARCH_OPTION_WITH_MARSHALLING ( ...)
Value:
PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)

◆ LANG_OPTION_WITH_MARSHALLING [1/2]

#define LANG_OPTION_WITH_MARSHALLING ( ...)
Value:
GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)

◆ LANG_OPTION_WITH_MARSHALLING [2/2]

#define LANG_OPTION_WITH_MARSHALLING ( ...)
Value:
PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)

◆ LANGOPT

#define LANGOPT ( Name,
Bits,
Default,
Compatibility,
Description )
Value:
if constexpr (CK::Compatibility != CK::Benign) \
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 )
Value:
if (KindValue == LangStandard::lang_##id) ++NumAliases;

◆ LANGSTANDARD_ALIAS [2/2]

#define LANGSTANDARD_ALIAS ( id,
alias )
Value:
if (KindValue == LangStandard::lang_##id) Diag << alias;
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.

◆ 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]

#define MIGRATOR_OPTION_WITH_MARSHALLING ( ...)
Value:
GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)

◆ MIGRATOR_OPTION_WITH_MARSHALLING [2/2]

#define MIGRATOR_OPTION_WITH_MARSHALLING ( ...)
Value:
PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)

◆ OPTTABLE_STR_TABLE_CODE

#define OPTTABLE_STR_TABLE_CODE

Definition at line 257 of file CompilerInvocation.cpp.

◆ 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:
if ((VISIBILITY) & options::CC1Option) { \
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 533 of file CompilerInvocation.cpp.

◆ PREPROCESSOR_OPTION_WITH_MARSHALLING [1/2]

#define PREPROCESSOR_OPTION_WITH_MARSHALLING ( ...)
Value:
GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)

◆ PREPROCESSOR_OPTION_WITH_MARSHALLING [2/2]

#define PREPROCESSOR_OPTION_WITH_MARSHALLING ( ...)
Value:
PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)

◆ PREPROCESSOR_OUTPUT_OPTION_WITH_MARSHALLING [1/2]

#define PREPROCESSOR_OUTPUT_OPTION_WITH_MARSHALLING ( ...)
Value:
GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)

◆ PREPROCESSOR_OUTPUT_OPTION_WITH_MARSHALLING [2/2]

#define PREPROCESSOR_OUTPUT_OPTION_WITH_MARSHALLING ( ...)
Value:
PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)

◆ SIMPLE_ENUM_VALUE_TABLE

#define SIMPLE_ENUM_VALUE_TABLE

Definition at line 265 of file CompilerInvocation.cpp.

◆ TARGET_OPTION_WITH_MARSHALLING [1/2]

#define TARGET_OPTION_WITH_MARSHALLING ( ...)
Value:
GENERATE_OPTION_WITH_MARSHALLING(Consumer, __VA_ARGS__)

◆ TARGET_OPTION_WITH_MARSHALLING [2/2]

#define TARGET_OPTION_WITH_MARSHALLING ( ...)
Value:
PARSE_OPTION_WITH_MARSHALLING(Args, Diags, __VA_ARGS__)

◆ VALUE_DEBUGOPT [1/2]

#define VALUE_DEBUGOPT ( Name,
Bits,
Default,
Compatibility )

◆ VALUE_DEBUGOPT [2/2]

#define VALUE_DEBUGOPT ( Name,
Bits,
Default,
Compatibility )
Value:
if constexpr (CK::Compatibility != CK::Benign) \
HBuilder.add(CodeGenOpts->Name);

Typedef Documentation

◆ ArgumentConsumer

using ArgumentConsumer = CompilerInvocation::ArgumentConsumer

Definition at line 255 of file CompilerInvocation.cpp.

◆ GenerateFn

using GenerateFn
Initial value:
llvm::function_ref<void(
CompilerInvocation::StringAllocator)>
Helper class for holding the data necessary to invoke the compiler.

Definition at line 771 of file CompilerInvocation.cpp.

◆ ParseFn

using ParseFn
Initial value:
DiagnosticsEngine &, const char *)>
Concrete class used by the front-end to report problems and issues.
Definition Diagnostic.h:231
#define bool
Definition gpuintrin.h:32

Definition at line 766 of file CompilerInvocation.cpp.

Function Documentation

◆ addDiagnosticArgs()

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

Definition at line 944 of file CompilerInvocation.cpp.

◆ checkVerifyPrefixes()

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

◆ denormalizeSimpleEnum()

template<typename T>
void denormalizeSimpleEnum ( ArgumentConsumer Consumer,
unsigned SpellingOffset,
Option::OptionClass OptClass,
unsigned TableIndex,
T Value )
static

Definition at line 433 of file CompilerInvocation.cpp.

References denormalizeSimpleEnumImpl(), and clang::T.

◆ denormalizeSimpleEnumImpl()

void denormalizeSimpleEnumImpl ( ArgumentConsumer Consumer,
unsigned SpellingOffset,
Option::OptionClass OptClass,
unsigned TableIndex,
unsigned Value )
static

◆ denormalizeSimpleFlag() [1/2]

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

Definition at line 296 of file CompilerInvocation.cpp.

◆ denormalizeSimpleFlag() [2/2]

void denormalizeSimpleFlag ( ArgumentConsumer Consumer,
unsigned SpellingOffset,
Option::OptionClass ,
unsigned ,
... )
static

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 291 of file CompilerInvocation.cpp.

References lookupStrInTable().

Referenced by GenerateArg().

◆ denormalizeString() [1/2]

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

Definition at line 373 of file CompilerInvocation.cpp.

References denormalizeStringImpl(), and clang::T.

◆ denormalizeString() [2/2]

template<typename T>
void denormalizeString ( ArgumentConsumer Consumer,
unsigned SpellingOffset,
Option::OptionClass OptClass,
unsigned TableIndex,
T Value )
static

◆ denormalizeStringImpl()

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

Definition at line 343 of file CompilerInvocation.cpp.

Referenced by denormalizeString(), and denormalizeString().

◆ denormalizeStringVector()

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

Definition at line 473 of file CompilerInvocation.cpp.

References denormalizeString().

◆ ensureOwned()

◆ extractForwardValue()

template<typename T>
T extractForwardValue ( T KeyPath)
static

Definition at line 524 of file CompilerInvocation.cpp.

References clang::T.

◆ extractMaskValue()

template<typename T, typename U, U Value>
T extractMaskValue ( T KeyPath)
static

Definition at line 529 of file CompilerInvocation.cpp.

References clang::T.

◆ findValueTableByName()

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

Definition at line 380 of file CompilerInvocation.cpp.

Referenced by normalizeSimpleEnum().

◆ findValueTableByValue()

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

Definition at line 389 of file CompilerInvocation.cpp.

References clang::Value::Value().

Referenced by denormalizeSimpleEnumImpl().

◆ FixupInvocation()

◆ GenerateAnalyzerArgs()

◆ GenerateAPINotesArgs()

◆ GenerateArg() [1/2]

◆ GenerateArg() [2/2]

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

◆ GenerateDependencyOutputArgs()

◆ GenerateFileSystemArgs()

void GenerateFileSystemArgs ( const FileSystemOptions & Opts,
ArgumentConsumer Consumer )
static

◆ GenerateFrontendArgs()

void GenerateFrontendArgs ( const FrontendOptions & Opts,
ArgumentConsumer Consumer,
bool IsHeader )
static

Definition at line 2855 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(), Feature, clang::ParsedSourceLocation::FileName, clang::frontend::FixIt, clang::FrontendOptions::FixItSuffix, std::function, 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()

◆ GenerateMigratorArgs()

void GenerateMigratorArgs ( const MigratorOptions & Opts,
ArgumentConsumer Consumer )
static

◆ GenerateOptimizationRemark()

void GenerateOptimizationRemark ( ArgumentConsumer Consumer,
OptSpecifier OptEQ,
StringRef Name,
const CodeGenOptions::OptRemark & Remark )
static

Generate a remark argument. This is an inverse of ParseOptimizationRemark.

Definition at line 1329 of file CompilerInvocation.cpp.

References GenerateArg(), clang::Remark, clang::CodeGenOptions::RK_Disabled, and clang::CodeGenOptions::RK_Enabled.

◆ GeneratePointerAuthArgs()

void GeneratePointerAuthArgs ( const LangOptions & Opts,
ArgumentConsumer Consumer )
static

◆ GeneratePreprocessorArgs()

◆ GeneratePreprocessorOutputArgs()

◆ GenerateTargetArgs()

◆ getAllNoBuiltinFuncValues()

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

Definition at line 970 of file CompilerInvocation.cpp.

References clang::Builtin::Context::isBuiltinFunc().

◆ getFrontendAction()

std::optional< frontend::ActionKind > getFrontendAction ( OptSpecifier & Opt)
static

Maps command line option to frontend action.

Definition at line 2837 of file CompilerInvocation.cpp.

References getFrontendActionTable().

Referenced by ParseFrontendArgs().

◆ getFrontendActionTable()

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 2780 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::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()

StringRef GetInputKindName ( InputKind IK)
static

◆ getOptimizationLevel()

unsigned getOptimizationLevel ( ArgList & Args,
InputKind IK,
DiagnosticsEngine & Diags )
static

◆ getOptimizationLevelSize()

unsigned getOptimizationLevelSize ( ArgList & Args)
static

Definition at line 735 of file CompilerInvocation.cpp.

◆ getProgramActionOpt()

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

Maps frontend action to command line option.

Definition at line 2847 of file CompilerInvocation.cpp.

References getFrontendActionTable().

Referenced by GenerateFrontendArgs().

◆ getStringOption()

StringRef getStringOption ( AnalyzerOptions::ConfigTable & Config,
StringRef OptionName,
StringRef DefaultVal )
static

Definition at line 1204 of file CompilerInvocation.cpp.

Referenced by initOption(), initOption(), initOption(), and initOption().

◆ initOption() [1/4]

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

◆ initOption() [2/4]

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

◆ initOption() [3/4]

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

Definition at line 1209 of file CompilerInvocation.cpp.

References getStringOption().

◆ initOption() [4/4]

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

◆ is_uint64_t_convertible()

template<typename T>
constexpr bool is_uint64_t_convertible ( )
staticconstexpr

Definition at line 302 of file CompilerInvocation.cpp.

◆ isCodeGenAction()

◆ IsInputCompatibleWithStandard()

bool IsInputCompatibleWithStandard ( InputKind IK,
const LangStandard & S )
static

◆ isStrictlyPreprocessorAction()

◆ lookupStrInTable()

llvm::StringRef lookupStrInTable ( unsigned Offset)
static

◆ make_shared_copy()

template<class T>
std::shared_ptr< T > make_shared_copy ( const T & X)

Definition at line 121 of file CompilerInvocation.cpp.

References clang::T, and X.

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

◆ makeBooleanOptionDenormalizer()

auto makeBooleanOptionDenormalizer ( bool Value)
static

Definition at line 335 of file CompilerInvocation.cpp.

References lookupStrInTable().

◆ makeBooleanOptionNormalizer()

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

Definition at line 323 of file CompilerInvocation.cpp.

◆ makeFlagToValueNormalizer() [1/2]

template<typename T, std::enable_if_t<!is_uint64_t_convertible< T >(), bool > = false>
auto makeFlagToValueNormalizer ( T Value)
static

Definition at line 308 of file CompilerInvocation.cpp.

References clang::T.

Referenced by makeFlagToValueNormalizer().

◆ makeFlagToValueNormalizer() [2/2]

template<typename T, std::enable_if_t< is_uint64_t_convertible< T >(), bool > = false>
auto makeFlagToValueNormalizer ( T Value)
static

Definition at line 319 of file CompilerInvocation.cpp.

References makeFlagToValueNormalizer(), and clang::T.

◆ mergeForwardValue()

template<typename T, typename U>
T mergeForwardValue ( T KeyPath,
U Value )
static

Definition at line 516 of file CompilerInvocation.cpp.

References clang::T.

◆ mergeMaskValue()

template<typename T, typename U>
T mergeMaskValue ( T KeyPath,
U Value )
static

Definition at line 520 of file CompilerInvocation.cpp.

References clang::T.

◆ normalizeSimpleEnum()

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

◆ normalizeSimpleFlag()

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

Definition at line 269 of file CompilerInvocation.cpp.

◆ normalizeSimpleNegativeFlag()

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

Definition at line 278 of file CompilerInvocation.cpp.

◆ normalizeString()

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

Definition at line 441 of file CompilerInvocation.cpp.

◆ normalizeStringIntegral()

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

Definition at line 452 of file CompilerInvocation.cpp.

References clang::DiagnosticsEngine::Report().

◆ normalizeStringVector()

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

Definition at line 468 of file CompilerInvocation.cpp.

◆ normalizeTriple()

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

Definition at line 505 of file CompilerInvocation.cpp.

◆ ParseAnalyzerArgs()

◆ parseAnalyzerConfigs()

◆ ParseAPINotesArgs()

void ParseAPINotesArgs ( APINotesOptions & Opts,
ArgList & Args,
DiagnosticsEngine & diags )
static

◆ ParseDependencyOutputArgs()

◆ parseDiagnosticLevelMask()

bool parseDiagnosticLevelMask ( StringRef FlagName,
const std::vector< std::string > & Levels,
DiagnosticsEngine & Diags,
DiagnosticLevelMask & M )
static

◆ ParseFileSystemArgs()

bool ParseFileSystemArgs ( FileSystemOptions & Opts,
const ArgList & Args,
DiagnosticsEngine & Diags )
static

Definition at line 2562 of file CompilerInvocation.cpp.

References clang::DiagnosticsEngine::getNumErrors().

◆ ParseFrontendArgs()

bool ParseFrontendArgs ( FrontendOptions & Opts,
ArgList & Args,
DiagnosticsEngine & Diags,
bool & IsHeaderFile )
static

Definition at line 3022 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::ClangIRDisableCIRVerifier, clang::FrontendOptions::ClangIRDisablePasses, 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::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()

◆ ParseMigratorArgs()

bool ParseMigratorArgs ( MigratorOptions & Opts,
const ArgList & Args,
DiagnosticsEngine & Diags )
static

Definition at line 2585 of file CompilerInvocation.cpp.

References clang::DiagnosticsEngine::getNumErrors().

◆ ParseOptimizationRemark()

CodeGenOptions::OptRemark ParseOptimizationRemark ( DiagnosticsEngine & Diags,
ArgList & Args,
OptSpecifier OptEQ,
StringRef Name )
static

Parse a remark command line argument.

It may be missing, disabled/enabled by '-R[no-]group' or specified with a regular expression by '-Rgroup=regexp'. On top of that, it can be disabled/enabled globally by '-R[no-]everything'.

Definition at line 1345 of file CompilerInvocation.cpp.

References clang::DiagnosticsEngine::Report(), clang::CodeGenOptions::RK_Disabled, clang::CodeGenOptions::RK_DisabledEverything, clang::CodeGenOptions::RK_Enabled, clang::CodeGenOptions::RK_EnabledEverything, and clang::CodeGenOptions::RK_WithPattern.

◆ ParsePointerAuthArgs()

void ParsePointerAuthArgs ( LangOptions & Opts,
ArgList & Args,
DiagnosticsEngine & Diags )
static

Definition at line 3614 of file CompilerInvocation.cpp.

References clang::PointerAuthSchema::ASDB.

◆ parsePointerAuthOptions()

void parsePointerAuthOptions ( PointerAuthOptions & Opts,
const LangOptions & LangOpts,
const llvm::Triple & Triple,
DiagnosticsEngine & Diags )
static

◆ ParsePreprocessorArgs()

◆ ParsePreprocessorOutputArgs()

◆ parseSanitizerKinds()

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

◆ parseSanitizerWeightedKinds()

SanitizerMaskCutoffs parseSanitizerWeightedKinds ( StringRef FlagName,
const std::vector< std::string > & Sanitizers,
DiagnosticsEngine & Diags )
static

◆ parseShowColorsArgs()

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

Definition at line 2503 of file CompilerInvocation.cpp.

◆ ParseTargetArgs()

◆ parseTestModuleFileExtensionArg()

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

Parse the argument to the -ftest-module-file-extension command-line argument.

Returns
true on error, false on success.

Definition at line 2756 of file CompilerInvocation.cpp.

Referenced by ParseFrontendArgs().

◆ parseToleranceOption()

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

Definition at line 109 of file CompilerInvocation.cpp.

◆ parseXRayInstrumentationBundle()

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

◆ RoundTrip()

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 )
static

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 793 of file CompilerInvocation.cpp.

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

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

◆ serializeSanitizerKinds()

SmallVector< StringRef, 4 > serializeSanitizerKinds ( SanitizerSet S)
static

Definition at line 1430 of file CompilerInvocation.cpp.

References clang::serializeSanitizerSet().

◆ serializeXRayInstrumentationBundle()

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

Definition at line 1467 of file CompilerInvocation.cpp.

References clang::serializeXRayInstrValue().

◆ setPGOUseInstrumentor()

void setPGOUseInstrumentor ( CodeGenOptions & Opts,
const Twine & ProfileName,
llvm::vfs::FileSystem & FS,
DiagnosticsEngine & Diags )
static