[llvm-branch-commits] [clang] 95d3cc6 - [clang][cli] Port CodeGenOpts simple string flags to new option parsing system
Jan Svoboda via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Dec 18 01:33:03 PST 2020
Author: Jan Svoboda
Date: 2020-12-18T10:28:48+01:00
New Revision: 95d3cc67caac04668ef808f65c30ced60ed14f5d
URL: https://github.com/llvm/llvm-project/commit/95d3cc67caac04668ef808f65c30ced60ed14f5d
DIFF: https://github.com/llvm/llvm-project/commit/95d3cc67caac04668ef808f65c30ced60ed14f5d.diff
LOG: [clang][cli] Port CodeGenOpts simple string flags to new option parsing system
Depends on D84668
Reviewed By: Bigcheese
Original patch by Daniel Grumberg.
Differential Revision: https://reviews.llvm.org/D84669
Added:
Modified:
clang/include/clang/Basic/CodeGenOptions.h
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/Driver/Options.td
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/Profile/c-generate.c
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/CodeGenOptions.h b/clang/include/clang/Basic/CodeGenOptions.h
index 5c540812ed31..ef4fa31256cd 100644
--- a/clang/include/clang/Basic/CodeGenOptions.h
+++ b/clang/include/clang/Basic/CodeGenOptions.h
@@ -30,6 +30,8 @@ namespace clang {
/// Bitfields of CodeGenOptions, split out from CodeGenOptions to ensure
/// that this large collection of bitfields is a trivial class type.
class CodeGenOptionsBase {
+ friend class CompilerInvocation;
+
public:
#define CODEGENOPT(Name, Bits, Default) unsigned Name : Bits;
#define ENUM_CODEGENOPT(Name, Type, Bits, Default)
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 0e85be8f058b..c67cce099a28 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -86,8 +86,6 @@ def err_drv_invalid_thread_model_for_target : Error<
"invalid thread model '%0' in '%1' for this target">;
def err_drv_invalid_linker_name : Error<
"invalid linker name in argument '%0'">;
-def err_drv_invalid_pgo_instrumentor : Error<
- "invalid PGO instrumentor in argument '%0'">;
def err_drv_invalid_rtlib_name : Error<
"invalid runtime library name in argument '%0'">;
def err_drv_unsupported_rtlib_for_platform : Error<
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index d143781d1d09..3e4fbf1fbb8f 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1053,7 +1053,10 @@ defm coroutines_ts : OptInFFlag<"coroutines-ts", "Enable support for the C++ Cor
def fembed_bitcode_EQ : Joined<["-"], "fembed-bitcode=">,
Group<f_Group>, Flags<[NoXarchOption, CC1Option, CC1AsOption]>, MetaVarName<"<option>">,
- HelpText<"Embed LLVM bitcode (option: off, all, bitcode, marker)">;
+ HelpText<"Embed LLVM bitcode (option: off, all, bitcode, marker)">,
+ Values<"off,all,bitcode,marker">, NormalizedValuesScope<"CodeGenOptions">,
+ NormalizedValues<["Embed_Off", "Embed_All", "Embed_Bitcode", "Embed_Marker"]>,
+ MarshallingInfoString<"CodeGenOpts.EmbedBitcode", "Embed_Off">, AutoNormalizeEnum;
def fembed_bitcode : Flag<["-"], "fembed-bitcode">, Group<f_Group>,
Alias<fembed_bitcode_EQ>, AliasArgs<["all"]>,
HelpText<"Embed LLVM IR bitcode as data">;
@@ -1070,7 +1073,8 @@ def fno_profile_sample_use : Flag<["-"], "fno-profile-sample-use">, Group<f_Grou
Flags<[CoreOption]>;
def fprofile_sample_use_EQ : Joined<["-"], "fprofile-sample-use=">,
Group<f_Group>, Flags<[NoXarchOption, CC1Option]>,
- HelpText<"Enable sample-based profile guided optimizations">;
+ HelpText<"Enable sample-based profile guided optimizations">,
+ MarshallingInfoString<"CodeGenOpts.SampleProfileFile">;
def fprofile_sample_accurate : Flag<["-"], "fprofile-sample-accurate">,
Group<f_Group>, Flags<[NoXarchOption, CC1Option]>,
HelpText<"Specifies that the sample profile is accurate">,
@@ -1093,7 +1097,8 @@ def fno_auto_profile_accurate : Flag<["-"], "fno-auto-profile-accurate">,
Group<f_Group>, Alias<fno_profile_sample_accurate>;
def fdebug_compilation_dir : Separate<["-"], "fdebug-compilation-dir">,
Group<f_Group>, Flags<[CC1Option, CC1AsOption, CoreOption]>,
- HelpText<"The compilation directory to embed in the debug info.">;
+ HelpText<"The compilation directory to embed in the debug info.">,
+ MarshallingInfoString<"CodeGenOpts.DebugCompilationDir">;
def fdebug_compilation_dir_EQ : Joined<["-"], "fdebug-compilation-dir=">,
Group<f_Group>, Flags<[CC1Option, CC1AsOption, CoreOption]>,
Alias<fdebug_compilation_dir>;
@@ -1114,7 +1119,8 @@ def fprofile_instr_use_EQ : Joined<["-"], "fprofile-instr-use=">,
HelpText<"Use instrumentation data for profile-guided optimization">;
def fprofile_remapping_file_EQ : Joined<["-"], "fprofile-remapping-file=">,
Group<f_Group>, Flags<[CC1Option, CoreOption]>, MetaVarName<"<file>">,
- HelpText<"Use the remappings described in <file> to match the profile data against names in the program">;
+ HelpText<"Use the remappings described in <file> to match the profile data against names in the program">,
+ MarshallingInfoString<"CodeGenOpts.ProfileRemappingFile">;
def fprofile_remapping_file : Separate<["-"], "fprofile-remapping-file">,
Group<f_Group>, Flags<[CoreOption]>, Alias<fprofile_remapping_file_EQ>;
defm coverage_mapping : BoolFOption<"coverage-mapping",
@@ -1362,7 +1368,7 @@ defm cxx_static_destructors : BoolFOption<"c++-static-destructors",
ChangedBy<NegFlag, [], "Disable C++ static destructor registration">,
ResetBy<PosFlag>>;
def fsymbol_partition_EQ : Joined<["-"], "fsymbol-partition=">, Group<f_Group>,
- Flags<[CC1Option]>;
+ Flags<[CC1Option]>, MarshallingInfoString<"CodeGenOpts.SymbolPartition">;
defm memory_profile : OptInFFlag<"memory-profile", "Enable", "Disable", " heap memory profiling">;
def fmemory_profile_EQ : Joined<["-"], "fmemory-profile=">,
@@ -1411,7 +1417,8 @@ def : Joined<["-"], "fsanitize-coverage-blacklist=">,
HelpText<"Deprecated, use -fsanitize-coverage-blocklist= instead">;
def fsanitize_memory_track_origins_EQ : Joined<["-"], "fsanitize-memory-track-origins=">,
Group<f_clang_Group>,
- HelpText<"Enable origins tracking in MemorySanitizer">;
+ HelpText<"Enable origins tracking in MemorySanitizer">,
+ MarshallingInfoStringInt<"CodeGenOpts.SanitizeMemoryTrackOrigins">;
def fsanitize_memory_track_origins : Flag<["-"], "fsanitize-memory-track-origins">,
Group<f_clang_Group>,
HelpText<"Enable origins tracking in MemorySanitizer">;
@@ -1541,7 +1548,8 @@ def fno_sanitize_thread_atomics : Flag<["-"], "fno-sanitize-thread-atomics">,
def fsanitize_undefined_strip_path_components_EQ : Joined<["-"], "fsanitize-undefined-strip-path-components=">,
Group<f_clang_Group>, MetaVarName<"<number>">,
HelpText<"Strip (or keep only, if negative) a given number of path components "
- "when emitting check metadata.">;
+ "when emitting check metadata.">,
+ MarshallingInfoStringInt<"CodeGenOpts.EmitCheckPathComponentsToStrip", "0", "int">;
} // end -f[no-]sanitize* flags
@@ -1677,7 +1685,8 @@ defm xray_instrument : OptInFFlag<"xray-instrument", "Generate XRay instrumentat
def fxray_instruction_threshold_EQ :
JoinedOrSeparate<["-"], "fxray-instruction-threshold=">,
Group<f_Group>, Flags<[CC1Option]>,
- HelpText<"Sets the minimum function size to instrument with XRay">;
+ HelpText<"Sets the minimum function size to instrument with XRay">,
+ MarshallingInfoStringInt<"CodeGenOpts.XRayInstructionThreshold", "200">;
def fxray_instruction_threshold_ :
JoinedOrSeparate<["-"], "fxray-instruction-threshold">,
Group<f_Group>, Flags<[CC1Option]>;
@@ -1771,7 +1780,8 @@ def fthinlto_index_EQ : Joined<["-"], "fthinlto-index=">,
HelpText<"Perform ThinLTO importing using provided function summary index">;
def fthin_link_bitcode_EQ : Joined<["-"], "fthin-link-bitcode=">,
Flags<[CoreOption, CC1Option]>, Group<f_Group>,
- HelpText<"Write minimized bitcode to <file> for the ThinLTO thin link only">;
+ HelpText<"Write minimized bitcode to <file> for the ThinLTO thin link only">,
+ MarshallingInfoString<"CodeGenOpts.ThinLinkBitcodeFile">;
def fmacro_backtrace_limit_EQ : Joined<["-"], "fmacro-backtrace-limit=">,
Group<f_Group>, Flags<[NoXarchOption, CoreOption]>;
defm merge_all_constants : BoolFOption<"merge-all-constants",
@@ -1967,7 +1977,11 @@ def fno_global_isel : Flag<["-"], "fno-global-isel">, Group<f_clang_Group>,
def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group<f_clang_Group>,
Alias<fno_global_isel>;
def fveclib : Joined<["-"], "fveclib=">, Group<f_Group>, Flags<[CC1Option]>,
- HelpText<"Use the given vector functions library">, Values<"Accelerate,libmvec,MASSV,SVML,none">;
+ HelpText<"Use the given vector functions library">,
+ Values<"Accelerate,libmvec,MASSV,SVML,none">,
+ NormalizedValuesScope<"CodeGenOptions">,
+ NormalizedValues<["Accelerate", "LIBMVEC", "MASSV", "SVML", "NoLibrary"]>,
+ MarshallingInfoString<"CodeGenOpts.VecLib", "NoLibrary">, AutoNormalizeEnum;
def fno_lax_vector_conversions : Flag<["-"], "fno-lax-vector-conversions">, Group<f_Group>,
Alias<flax_vector_conversions_EQ>, AliasArgs<["none"]>;
def fno_modules : Flag <["-"], "fno-modules">, Group<f_Group>,
@@ -2147,8 +2161,12 @@ defm pascal_strings : BoolFOption<"pascal-strings",
"LangOpts->PascalStrings", DefaultsToFalse,
ChangedBy<PosFlag, [], "Recognize and construct Pascal-style string literals">,
ResetBy<NegFlag>>;
+// Note: This flag has
diff erent semantics in the driver and in -cc1. The driver accepts -fpatchable-function-entry=M,N
+// and forwards it to -cc1 as -fpatchable-function-entry=M and -fpatchable-function-entry-offset=N. In -cc1, both flags
+// are treated as a single integer.
def fpatchable_function_entry_EQ : Joined<["-"], "fpatchable-function-entry=">, Group<f_Group>, Flags<[CC1Option]>,
- MetaVarName<"<N,M>">, HelpText<"Generate M NOPs before function entry and N-M NOPs after function entry">;
+ MetaVarName<"<N,M>">, HelpText<"Generate M NOPs before function entry and N-M NOPs after function entry">,
+ MarshallingInfoStringInt<"CodeGenOpts.PatchableFunctionEntryCount">;
def fpcc_struct_return : Flag<["-"], "fpcc-struct-return">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Override the default ABI to return all structs on the stack">;
def fpch_preprocess : Flag<["-"], "fpch-preprocess">, Group<f_Group>;
@@ -2347,7 +2365,11 @@ def fproc_stat_report : Joined<["-"], "fproc-stat-report">, Group<f_Group>,
HelpText<"Print subprocess statistics">;
def fproc_stat_report_EQ : Joined<["-"], "fproc-stat-report=">, Group<f_Group>,
HelpText<"Save subprocess statistics to the given file">;
-def ftlsmodel_EQ : Joined<["-"], "ftls-model=">, Group<f_Group>, Flags<[CC1Option]>;
+def ftlsmodel_EQ : Joined<["-"], "ftls-model=">, Group<f_Group>, Flags<[CC1Option]>,
+ Values<"global-dynamic,local-dynamic,initial-exec,local-exec">,
+ NormalizedValuesScope<"CodeGenOptions">,
+ NormalizedValues<["GeneralDynamicTLSModel", "LocalDynamicTLSModel", "InitialExecTLSModel", "LocalExecTLSModel"]>,
+ MarshallingInfoString<"CodeGenOpts.DefaultTLSModel", "GeneralDynamicTLSModel">, AutoNormalizeEnum;
def ftrapv : Flag<["-"], "ftrapv">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Trap on integer overflow">;
def ftrapv_handler_EQ : Joined<["-"], "ftrapv-handler=">, Group<f_Group>,
@@ -2355,7 +2377,8 @@ def ftrapv_handler_EQ : Joined<["-"], "ftrapv-handler=">, Group<f_Group>,
HelpText<"Specify the function to be called on overflow">;
def ftrapv_handler : Separate<["-"], "ftrapv-handler">, Group<f_Group>, Flags<[CC1Option]>;
def ftrap_function_EQ : Joined<["-"], "ftrap-function=">, Group<f_Group>, Flags<[CC1Option]>,
- HelpText<"Issue call to specified function rather than a trap instruction">;
+ HelpText<"Issue call to specified function rather than a trap instruction">,
+ MarshallingInfoString<"CodeGenOpts.TrapFuncName">;
def funit_at_a_time : Flag<["-"], "funit-at-a-time">, Group<f_Group>;
def funroll_loops : Flag<["-"], "funroll-loops">, Group<f_Group>,
HelpText<"Turn on loop unroller">, Flags<[CC1Option]>;
@@ -2441,7 +2464,8 @@ def fbasic_block_sections_EQ : Joined<["-"], "fbasic-block-sections=">, Group<f_
Flags<[CC1Option, CC1AsOption]>,
HelpText<"Place each function's basic blocks in unique sections (ELF Only) : all | labels | none | list=<file>">,
DocBrief<[{Generate labels for each basic block or place each basic block or a subset of basic blocks in its own section.}]>,
- Values<"all,labels,none,list=">;
+ Values<"all,labels,none,list=">,
+ MarshallingInfoString<"CodeGenOpts.BBSections", [{"none"}]>;
defm data_sections : BoolFOption<"data-sections",
"CodeGenOpts.DataSections", DefaultsToFalse,
ChangedBy<PosFlag, [], "Place each data in its own section">, ResetBy<NegFlag>>;
@@ -2721,7 +2745,8 @@ def mcmodel_EQ : Joined<["-"], "mcmodel=">, Group<m_Group>, Flags<[CC1Option]>,
MarshallingInfoString<"TargetOpts->CodeModel", [{"default"}]>;
def mtls_size_EQ : Joined<["-"], "mtls-size=">, Group<m_Group>, Flags<[NoXarchOption, CC1Option]>,
HelpText<"Specify bit size of immediate TLS offsets (AArch64 ELF only): "
- "12 (for 4KB) | 24 (for 16MB, default) | 32 (for 4GB) | 48 (for 256TB, needs -mcmodel=large)">;
+ "12 (for 4KB) | 24 (for 16MB, default) | 32 (for 4GB) | 48 (for 256TB, needs -mcmodel=large)">,
+ MarshallingInfoStringInt<"CodeGenOpts.TLSSize">;
def mimplicit_it_EQ : Joined<["-"], "mimplicit-it=">, Group<m_Group>;
def mdefault_build_attributes : Joined<["-"], "mdefault-build-attributes">, Group<m_Group>;
def mno_default_build_attributes : Joined<["-"], "mno-default-build-attributes">, Group<m_Group>;
@@ -2777,9 +2802,11 @@ def mstackrealign : Flag<["-"], "mstackrealign">, Group<m_Group>, Flags<[CC1Opti
HelpText<"Force realign the stack at entry to every function">,
MarshallingInfoFlag<"CodeGenOpts.StackRealignment">;
def mstack_alignment : Joined<["-"], "mstack-alignment=">, Group<m_Group>, Flags<[CC1Option]>,
- HelpText<"Set the stack alignment">;
+ HelpText<"Set the stack alignment">,
+ MarshallingInfoStringInt<"CodeGenOpts.StackAlignment">;
def mstack_probe_size : Joined<["-"], "mstack-probe-size=">, Group<m_Group>, Flags<[CC1Option]>,
- HelpText<"Set the stack probe size">;
+ HelpText<"Set the stack probe size">,
+ MarshallingInfoStringInt<"CodeGenOpts.StackProbeSize", "4096">;
def mstack_arg_probe : Flag<["-"], "mstack-arg-probe">, Group<m_Group>,
HelpText<"Enable stack probes">;
def mno_stack_arg_probe : Flag<["-"], "mno-stack-arg-probe">, Group<m_Group>, Flags<[CC1Option]>,
@@ -3097,7 +3124,8 @@ def mimplicit_float : Flag<["-"], "mimplicit-float">, Group<m_Group>;
def mrecip : Flag<["-"], "mrecip">, Group<m_Group>;
def mrecip_EQ : CommaJoined<["-"], "mrecip=">, Group<m_Group>, Flags<[CC1Option]>;
def mprefer_vector_width_EQ : Joined<["-"], "mprefer-vector-width=">, Group<m_Group>, Flags<[CC1Option]>,
- HelpText<"Specifies preferred vector width for auto-vectorization. Defaults to 'none' which allows target specific decisions.">;
+ HelpText<"Specifies preferred vector width for auto-vectorization. Defaults to 'none' which allows target specific decisions.">,
+ MarshallingInfoString<"CodeGenOpts.PreferVectorWidth">;
def mstack_protector_guard_EQ : Joined<["-"], "mstack-protector-guard=">, Group<m_Group>, Flags<[CC1Option]>,
HelpText<"Use the given guard (global, tls) for addressing the stack-protector guard">;
def mstack_protector_guard_offset_EQ : Joined<["-"], "mstack-protector-guard-offset=">, Group<m_Group>, Flags<[CC1Option]>,
@@ -4283,18 +4311,29 @@ def migrator_no_finalize_removal : Flag<["-"], "no-finalize-removal">,
//===----------------------------------------------------------------------===//
let Flags = [CC1Option, CC1AsOption, NoDriverOption] in {
-def debug_info_kind_EQ : Joined<["-"], "debug-info-kind=">;
+def debug_info_kind_EQ : Joined<["-"], "debug-info-kind=">,
+ Values<"line-tables-only,line-directives-only,constructor,limited,standalone,unused-types">,
+ NormalizedValuesScope<"codegenoptions">,
+ NormalizedValues<["DebugLineTablesOnly", "DebugDirectivesOnly", "DebugInfoConstructor",
+ "LimitedDebugInfo", "FullDebugInfo", "UnusedTypeInfo"]>,
+ MarshallingInfoString<"CodeGenOpts.DebugInfo", "NoDebugInfo">, AutoNormalizeEnum;
def debug_info_macro : Flag<["-"], "debug-info-macro">,
HelpText<"Emit macro debug information">,
MarshallingInfoFlag<"CodeGenOpts.MacroDebugInfo">;
def default_function_attr : Separate<["-"], "default-function-attr">,
HelpText<"Apply given attribute to all functions">;
-def dwarf_version_EQ : Joined<["-"], "dwarf-version=">;
-def debugger_tuning_EQ : Joined<["-"], "debugger-tuning=">;
+def dwarf_version_EQ : Joined<["-"], "dwarf-version=">,
+ MarshallingInfoStringInt<"CodeGenOpts.DwarfVersion">;
+def debugger_tuning_EQ : Joined<["-"], "debugger-tuning=">,
+ Values<"gdb,lldb,sce">,
+ NormalizedValuesScope<"llvm::DebuggerKind">, NormalizedValues<["GDB", "LLDB", "SCE"]>,
+ MarshallingInfoString<"CodeGenOpts.DebuggerTuning", "Default">, AutoNormalizeEnum;
def dwarf_debug_flags : Separate<["-"], "dwarf-debug-flags">,
- HelpText<"The string to embed in the Dwarf debug flags record.">;
+ HelpText<"The string to embed in the Dwarf debug flags record.">,
+ MarshallingInfoString<"CodeGenOpts.DwarfDebugFlags">;
def record_command_line : Separate<["-"], "record-command-line">,
- HelpText<"The string to embed in the .LLVM.command.line section.">;
+ HelpText<"The string to embed in the .LLVM.command.line section.">,
+ MarshallingInfoString<"CodeGenOpts.RecordCommandLine">;
def compress_debug_sections_EQ : Joined<["-", "--"], "compress-debug-sections=">,
HelpText<"DWARF debug sections compression type">;
def compress_debug_sections : Flag<["-", "--"], "compress-debug-sections">,
@@ -4397,9 +4436,12 @@ def no_struct_path_tbaa : Flag<["-"], "no-struct-path-tbaa">,
def new_struct_path_tbaa : Flag<["-"], "new-struct-path-tbaa">,
HelpText<"Enable enhanced struct-path aware Type Based Alias Analysis">;
def mdebug_pass : Separate<["-"], "mdebug-pass">,
- HelpText<"Enable additional debug output">;
+ HelpText<"Enable additional debug output">,
+ MarshallingInfoString<"CodeGenOpts.DebugPass">;
def mframe_pointer_EQ : Joined<["-"], "mframe-pointer=">,
- HelpText<"Specify which frame pointers to retain (all, non-leaf, none).">, Values<"all,non-leaf,none">;
+ HelpText<"Specify which frame pointers to retain (all, non-leaf, none).">, Values<"all,non-leaf,none">,
+ NormalizedValuesScope<"CodeGenOptions::FramePointerKind">, NormalizedValues<["All", "NonLeaf", "None"]>,
+ MarshallingInfoString<"CodeGenOpts.FramePointer", "None">, AutoNormalizeEnum;
def mdisable_tail_calls : Flag<["-"], "mdisable-tail-calls">,
HelpText<"Disable tail call optimization, keeping the call stack accurate">,
MarshallingInfoFlag<"CodeGenOpts.DisableTailCalls">;
@@ -4416,18 +4458,22 @@ def mabi_EQ_ieeelongdouble : Flag<["-"], "mabi=ieeelongdouble">,
HelpText<"Use IEEE 754 quadruple-precision for long double">,
MarshallingInfoFlag<"LangOpts->PPCIEEELongDouble">;
def mfloat_abi : Separate<["-"], "mfloat-abi">,
- HelpText<"The float ABI to use">;
+ HelpText<"The float ABI to use">,
+ MarshallingInfoString<"CodeGenOpts.FloatABI">;
def mtp : Separate<["-"], "mtp">,
HelpText<"Mode for reading thread pointer">;
def mlimit_float_precision : Separate<["-"], "mlimit-float-precision">,
- HelpText<"Limit float precision to the given value">;
+ HelpText<"Limit float precision to the given value">,
+ MarshallingInfoString<"CodeGenOpts.LimitFloatPrecision">;
def split_stacks : Flag<["-"], "split-stacks">,
HelpText<"Try to use a split stack if possible.">,
MarshallingInfoFlag<"CodeGenOpts.EnableSegmentedStacks">;
def mregparm : Separate<["-"], "mregparm">,
- HelpText<"Limit the number of registers available for integer arguments">;
+ HelpText<"Limit the number of registers available for integer arguments">,
+ MarshallingInfoStringInt<"CodeGenOpts.NumRegisterParameters">;
def msmall_data_limit : Separate<["-"], "msmall-data-limit">,
- HelpText<"Put global and static data smaller than the limit into a special section">;
+ HelpText<"Put global and static data smaller than the limit into a special section">,
+ MarshallingInfoStringInt<"CodeGenOpts.SmallDataLimit">;
def munwind_tables : Flag<["-"], "munwind-tables">,
HelpText<"Generate unwinding tables for all functions">,
MarshallingInfoFlag<"CodeGenOpts.UnwindTables">;
@@ -4452,7 +4498,8 @@ def dependent_lib : Joined<["--"], "dependent-lib=">,
def linker_option : Joined<["--"], "linker-option=">,
HelpText<"Add linker option">;
def fsanitize_coverage_type : Joined<["-"], "fsanitize-coverage-type=">,
- HelpText<"Sanitizer coverage type">;
+ HelpText<"Sanitizer coverage type">,
+ MarshallingInfoStringInt<"CodeGenOpts.SanitizeCoverageType">;
def fsanitize_coverage_indirect_calls
: Flag<["-"], "fsanitize-coverage-indirect-calls">,
HelpText<"Enable sanitizer coverage for indirect calls">,
@@ -4507,16 +4554,22 @@ def fsanitize_coverage_stack_depth
MarshallingInfoFlag<"CodeGenOpts.SanitizeCoverageStackDepth">;
def fpatchable_function_entry_offset_EQ
: Joined<["-"], "fpatchable-function-entry-offset=">, MetaVarName<"<M>">,
- HelpText<"Generate M NOPs before function entry">;
+ HelpText<"Generate M NOPs before function entry">,
+ MarshallingInfoStringInt<"CodeGenOpts.PatchableFunctionEntryOffset">;
def fprofile_instrument_EQ : Joined<["-"], "fprofile-instrument=">,
HelpText<"Enable PGO instrumentation. The accepted value is clang, llvm, "
- "or none">, Values<"none,clang,llvm">;
+ "or none">, Values<"none,clang,llvm,csllvm">,
+ NormalizedValuesScope<"CodeGenOptions">,
+ NormalizedValues<["ProfileNone", "ProfileClangInstr", "ProfileIRInstr", "ProfileCSIRInstr"]>,
+ MarshallingInfoString<"CodeGenOpts.ProfileInstr", "ProfileNone">, AutoNormalizeEnum;
def fprofile_instrument_path_EQ : Joined<["-"], "fprofile-instrument-path=">,
HelpText<"Generate instrumented code to collect execution counts into "
- "<file> (overridden by LLVM_PROFILE_FILE env var)">;
+ "<file> (overridden by LLVM_PROFILE_FILE env var)">,
+ MarshallingInfoString<"CodeGenOpts.InstrProfileOutput">;
def fprofile_instrument_use_path_EQ :
Joined<["-"], "fprofile-instrument-use-path=">,
- HelpText<"Specify the profile path in PGO use compilation">;
+ HelpText<"Specify the profile path in PGO use compilation">,
+ MarshallingInfoString<"CodeGenOpts.ProfileInstrumentUsePath">;
def flto_visibility_public_std:
Flag<["-"], "flto-visibility-public-std">,
HelpText<"Use public LTO visibility for classes in std and stdext namespaces">,
@@ -4832,7 +4885,8 @@ def arcmt_action_EQ : Joined<["-"], "arcmt-action=">, Flags<[CC1Option, NoDriver
AutoNormalizeEnumJoined;
def opt_record_file : Separate<["-"], "opt-record-file">,
- HelpText<"File name to use for YAML optimization record output">;
+ HelpText<"File name to use for YAML optimization record output">,
+ MarshallingInfoString<"CodeGenOpts.OptRecordFile">;
def opt_record_passes : Separate<["-"], "opt-record-passes">,
HelpText<"Only record remark information for passes whose names match the given regular expression">;
def opt_record_format : Separate<["-"], "opt-record-format">,
@@ -4894,9 +4948,11 @@ def version : Flag<["-"], "version">,
HelpText<"Print the compiler version">,
MarshallingInfoFlag<"FrontendOpts.ShowVersion">;
def main_file_name : Separate<["-"], "main-file-name">,
- HelpText<"Main file name to use for debug info and source if missing">;
+ HelpText<"Main file name to use for debug info and source if missing">,
+ MarshallingInfoString<"CodeGenOpts.MainFileName">;
def split_dwarf_output : Separate<["-"], "split-dwarf-output">,
- HelpText<"File name to use for split dwarf debug info output">;
+ HelpText<"File name to use for split dwarf debug info output">,
+ MarshallingInfoString<"CodeGenOpts.SplitDwarfOutput">;
}
@@ -4907,7 +4963,8 @@ def fexternc_nounwind : Flag<["-"], "fexternc-nounwind">,
HelpText<"Assume all functions with C linkage do not unwind">,
MarshallingInfoFlag<"LangOpts->ExternCNoUnwind">;
def split_dwarf_file : Separate<["-"], "split-dwarf-file">,
- HelpText<"Name of the split dwarf debug info file to encode in the object file">;
+ HelpText<"Name of the split dwarf debug info file to encode in the object file">,
+ MarshallingInfoString<"CodeGenOpts.SplitDwarfFile">;
def fno_wchar : Flag<["-"], "fno-wchar">,
HelpText<"Disable C++ builtin type wchar_t">;
def fconstant_string_class : Separate<["-"], "fconstant-string-class">,
@@ -4921,7 +4978,9 @@ def fobjc_arc_cxxlib_EQ : Joined<["-"], "fobjc-arc-cxxlib=">,
def fobjc_runtime_has_weak : Flag<["-"], "fobjc-runtime-has-weak">,
HelpText<"The target Objective-C runtime supports ARC weak operations">;
def fobjc_dispatch_method_EQ : Joined<["-"], "fobjc-dispatch-method=">,
- HelpText<"Objective-C dispatch method to use">, Values<"legacy,non-legacy,mixed">;
+ HelpText<"Objective-C dispatch method to use">, Values<"legacy,non-legacy,mixed">,
+ NormalizedValuesScope<"CodeGenOptions">, NormalizedValues<["Legacy", "NonLegacy", "Mixed"]>,
+ MarshallingInfoString<"CodeGenOpts.ObjCDispatchMethod", "Legacy">, AutoNormalizeEnum;
def disable_objc_default_synthesize_properties : Flag<["-"], "disable-objc-default-synthesize-properties">,
HelpText<"disable the default synthesis of Objective-C properties">,
MarshallingInfoFlag<"LangOpts->ObjCDefaultSynthProperties", "true">, IsNegative;
@@ -4959,7 +5018,8 @@ def stack_protector : Separate<["-"], "stack-protector">,
NormalizedValues<["SSPOff", "SSPOn", "SSPStrong", "SSPReq"]>,
MarshallingInfoString<"LangOpts->StackProtector", "SSPOff">, AutoNormalizeEnum;
def stack_protector_buffer_size : Separate<["-"], "stack-protector-buffer-size">,
- HelpText<"Lower bound for a buffer to be considered for stack protection">;
+ HelpText<"Lower bound for a buffer to be considered for stack protection">,
+ MarshallingInfoStringInt<"CodeGenOpts.SSPBufferSize", "8">;
// FIXME: diagnose if target does not support protected visibility
// Good place for this is CompilerInvocation::fixupInvocation. Do the same for parseVisibility.
def fvisibility : Separate<["-"], "fvisibility">,
@@ -5137,7 +5197,8 @@ def fcuda_is_device : Flag<["-"], "fcuda-is-device">,
HelpText<"Generate code for CUDA device">,
MarshallingInfoFlag<"LangOpts->CUDAIsDevice">;
def fcuda_include_gpubinary : Separate<["-"], "fcuda-include-gpubinary">,
- HelpText<"Incorporate CUDA device-side binary into host object file.">;
+ HelpText<"Incorporate CUDA device-side binary into host object file.">,
+ MarshallingInfoString<"CodeGenOpts.CudaGpuBinaryFileName">;
def fcuda_allow_variadic_functions : Flag<["-"], "fcuda-allow-variadic-functions">,
HelpText<"Allow variadic functions in CUDA device code.">,
MarshallingInfoFlag<"LangOpts->CUDAAllowVariadicFunctions">;
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 26326032b1d3..00615a70d730 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -353,7 +353,7 @@ static T extractMaskValue(T KeyPath) {
static void FixupInvocation(CompilerInvocation &Invocation,
DiagnosticsEngine &Diags,
- InputArgList &Args) {
+ const InputArgList &Args) {
LangOptions &LangOpts = *Invocation.getLangOpts();
DiagnosticOptions &DiagOpts = Invocation.getDiagnosticOpts();
CodeGenOptions &CodeGenOpts = Invocation.getCodeGenOpts();
@@ -403,6 +403,11 @@ static void FixupInvocation(CompilerInvocation &Invocation,
Diags.Report(diag::err_drv_argument_not_allowed_with)
<< A->getSpelling() << T.getTriple();
}
+
+ if (!CodeGenOpts.ProfileRemappingFile.empty() && CodeGenOpts.LegacyPassManager)
+ Diags.Report(diag::err_drv_argument_only_allowed_with)
+ << Args.getLastArg(OPT_fprofile_remapping_file_EQ)->getAsString(Args)
+ << "-fno-legacy-pass-manager";
}
//===----------------------------------------------------------------------===//
@@ -845,28 +850,6 @@ static void parseXRayInstrumentationBundle(StringRef FlagName, StringRef Bundle,
}
}
-// Set the profile kind for fprofile-instrument.
-static void setPGOInstrumentor(CodeGenOptions &Opts, ArgList &Args,
- DiagnosticsEngine &Diags) {
- Arg *A = Args.getLastArg(OPT_fprofile_instrument_EQ);
- if (A == nullptr)
- return;
- StringRef S = A->getValue();
- unsigned I = llvm::StringSwitch<unsigned>(S)
- .Case("none", CodeGenOptions::ProfileNone)
- .Case("clang", CodeGenOptions::ProfileClangInstr)
- .Case("llvm", CodeGenOptions::ProfileIRInstr)
- .Case("csllvm", CodeGenOptions::ProfileCSIRInstr)
- .Default(~0U);
- if (I == ~0U) {
- Diags.Report(diag::err_drv_invalid_pgo_instrumentor) << A->getAsString(Args)
- << S;
- return;
- }
- auto Instrumentor = static_cast<CodeGenOptions::ProfileInstrKind>(I);
- Opts.setProfileInstr(Instrumentor);
-}
-
// Set the profile kind using fprofile-instrument-use-path.
static void setPGOUseInstrumentor(CodeGenOptions &Opts,
const Twine &ProfileName) {
@@ -928,61 +911,12 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
}
}
- if (Arg *A = Args.getLastArg(OPT_fveclib)) {
- StringRef Name = A->getValue();
- if (Name == "Accelerate")
- Opts.setVecLib(CodeGenOptions::Accelerate);
- else if (Name == "libmvec")
- Opts.setVecLib(CodeGenOptions::LIBMVEC);
- else if (Name == "MASSV")
- Opts.setVecLib(CodeGenOptions::MASSV);
- else if (Name == "SVML")
- Opts.setVecLib(CodeGenOptions::SVML);
- else if (Name == "none")
- Opts.setVecLib(CodeGenOptions::NoLibrary);
- else
- Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
- }
-
- if (Arg *A = Args.getLastArg(OPT_debug_info_kind_EQ)) {
- unsigned Val =
- llvm::StringSwitch<unsigned>(A->getValue())
- .Case("line-tables-only", codegenoptions::DebugLineTablesOnly)
- .Case("line-directives-only", codegenoptions::DebugDirectivesOnly)
- .Case("constructor", codegenoptions::DebugInfoConstructor)
- .Case("limited", codegenoptions::LimitedDebugInfo)
- .Case("standalone", codegenoptions::FullDebugInfo)
- .Case("unused-types", codegenoptions::UnusedTypeInfo)
- .Default(~0U);
- if (Val == ~0U)
- Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args)
- << A->getValue();
- else
- Opts.setDebugInfo(static_cast<codegenoptions::DebugInfoKind>(Val));
- }
// If -fuse-ctor-homing is set and limited debug info is already on, then use
// constructor homing.
if (Args.getLastArg(OPT_fuse_ctor_homing))
if (Opts.getDebugInfo() == codegenoptions::LimitedDebugInfo)
Opts.setDebugInfo(codegenoptions::DebugInfoConstructor);
- if (Arg *A = Args.getLastArg(OPT_debugger_tuning_EQ)) {
- unsigned Val = llvm::StringSwitch<unsigned>(A->getValue())
- .Case("gdb", unsigned(llvm::DebuggerKind::GDB))
- .Case("lldb", unsigned(llvm::DebuggerKind::LLDB))
- .Case("sce", unsigned(llvm::DebuggerKind::SCE))
- .Default(~0U);
- if (Val == ~0U)
- Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args)
- << A->getValue();
- else
- Opts.setDebuggerTuning(static_cast<llvm::DebuggerKind>(Val));
- }
- Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 0, Diags);
- Opts.SplitDwarfFile = std::string(Args.getLastArgValue(OPT_split_dwarf_file));
- Opts.SplitDwarfOutput =
- std::string(Args.getLastArgValue(OPT_split_dwarf_output));
-
for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) {
auto Split = StringRef(Arg).split('=');
Opts.DebugPrefixMap.insert(
@@ -1001,10 +935,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.NewStructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa) &&
Args.hasArg(OPT_new_struct_path_tbaa);
- Opts.DwarfDebugFlags =
- std::string(Args.getLastArgValue(OPT_dwarf_debug_flags));
- Opts.RecordCommandLine =
- std::string(Args.getLastArgValue(OPT_record_command_line));
Opts.OptimizeSize = getOptimizationLevelSize(Args);
Opts.SimplifyLibCalls = !(Args.hasArg(OPT_fno_builtin) ||
Args.hasArg(OPT_ffreestanding));
@@ -1014,8 +944,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Args.hasFlag(OPT_funroll_loops, OPT_fno_unroll_loops,
(Opts.OptimizationLevel > 1));
- Opts.SampleProfileFile =
- std::string(Args.getLastArgValue(OPT_fprofile_sample_use_EQ));
Opts.DebugNameTable = static_cast<unsigned>(
Args.hasArg(OPT_ggnu_pubnames)
? llvm::DICompileUnit::DebugNameTableKind::GNU
@@ -1023,43 +951,10 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
? llvm::DICompileUnit::DebugNameTableKind::Default
: llvm::DICompileUnit::DebugNameTableKind::None);
- setPGOInstrumentor(Opts, Args, Diags);
- Opts.InstrProfileOutput =
- std::string(Args.getLastArgValue(OPT_fprofile_instrument_path_EQ));
- Opts.ProfileInstrumentUsePath =
- std::string(Args.getLastArgValue(OPT_fprofile_instrument_use_path_EQ));
if (!Opts.ProfileInstrumentUsePath.empty())
setPGOUseInstrumentor(Opts, Opts.ProfileInstrumentUsePath);
- Opts.ProfileRemappingFile =
- std::string(Args.getLastArgValue(OPT_fprofile_remapping_file_EQ));
- if (!Opts.ProfileRemappingFile.empty() && Opts.LegacyPassManager) {
- Diags.Report(diag::err_drv_argument_only_allowed_with)
- << Args.getLastArg(OPT_fprofile_remapping_file_EQ)->getAsString(Args)
- << "-fno-legacy-pass-manager";
- }
Opts.CodeModel = TargetOpts.CodeModel;
- Opts.DebugPass = std::string(Args.getLastArgValue(OPT_mdebug_pass));
-
- // Handle -mframe-pointer option.
- if (Arg *A = Args.getLastArg(OPT_mframe_pointer_EQ)) {
- CodeGenOptions::FramePointerKind FP;
- StringRef Name = A->getValue();
- bool ValidFP = true;
- if (Name == "none")
- FP = CodeGenOptions::FramePointerKind::None;
- else if (Name == "non-leaf")
- FP = CodeGenOptions::FramePointerKind::NonLeaf;
- else if (Name == "all")
- FP = CodeGenOptions::FramePointerKind::All;
- else {
- Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
- Success = false;
- ValidFP = false;
- }
- if (ValidFP)
- Opts.setFramePointer(FP);
- }
if (const Arg *A = Args.getLastArg(OPT_ftime_report, OPT_ftime_report_EQ)) {
Opts.TimePasses = true;
@@ -1081,19 +976,8 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
}
}
- Opts.FloatABI = std::string(Args.getLastArgValue(OPT_mfloat_abi));
- Opts.LimitFloatPrecision =
- std::string(Args.getLastArgValue(OPT_mlimit_float_precision));
Opts.Reciprocals = Args.getAllArgValues(OPT_mrecip_EQ);
- Opts.NumRegisterParameters = getLastArgIntValue(Args, OPT_mregparm, 0, Diags);
- Opts.SmallDataLimit =
- getLastArgIntValue(Args, OPT_msmall_data_limit, 0, Diags);
- Opts.TrapFuncName = std::string(Args.getLastArgValue(OPT_ftrap_function_EQ));
-
- Opts.BBSections =
- std::string(Args.getLastArgValue(OPT_fbasic_block_sections_EQ, "none"));
-
// Basic Block Sections implies Function Sections.
Opts.FunctionSections =
Args.hasArg(OPT_ffunction_sections) ||
@@ -1121,9 +1005,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
.Case("obj", FrontendOpts.OutputFile)
.Default(llvm::sys::path::filename(FrontendOpts.OutputFile).str());
- Opts.ThinLinkBitcodeFile =
- std::string(Args.getLastArgValue(OPT_fthin_link_bitcode_EQ));
-
// The memory profile runtime appends the pid to make this name more unique.
const char *MemProfileBasename = "memprof.profraw";
if (Args.hasArg(OPT_fmemory_profile_EQ)) {
@@ -1134,11 +1015,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
} else if (Args.hasArg(OPT_fmemory_profile))
Opts.MemoryProfileOutput = MemProfileBasename;
- Opts.PreferVectorWidth =
- std::string(Args.getLastArgValue(OPT_mprefer_vector_width_EQ));
-
- Opts.MainFileName = std::string(Args.getLastArgValue(OPT_main_file_name));
-
if (Opts.EmitGcovArcs || Opts.EmitGcovNotes) {
Opts.CoverageDataFile =
std::string(Args.getLastArgValue(OPT_coverage_data_file));
@@ -1159,22 +1035,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
}
}
}
- // Handle -fembed-bitcode option.
- if (Arg *A = Args.getLastArg(OPT_fembed_bitcode_EQ)) {
- StringRef Name = A->getValue();
- unsigned Model = llvm::StringSwitch<unsigned>(Name)
- .Case("off", CodeGenOptions::Embed_Off)
- .Case("all", CodeGenOptions::Embed_All)
- .Case("bitcode", CodeGenOptions::Embed_Bitcode)
- .Case("marker", CodeGenOptions::Embed_Marker)
- .Default(~0U);
- if (Model == ~0U) {
- Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
- Success = false;
- } else
- Opts.setEmbedBitcode(
- static_cast<CodeGenOptions::EmbedBitcodeKind>(Model));
- }
// FIXME: For backend options that are not yet recorded as function
// attributes in the IR, keep track of them so we can embed them in a
// separate data section and use them when building the bitcode.
@@ -1196,8 +1056,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
}
}
- Opts.XRayInstructionThreshold =
- getLastArgIntValue(Args, OPT_fxray_instruction_threshold_EQ, 200, Diags);
Opts.XRayTotalFunctionGroups =
getLastArgIntValue(Args, OPT_fxray_function_groups, 1, Diags);
Opts.XRaySelectedFunctionGroup =
@@ -1212,11 +1070,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
parseXRayInstrumentationBundle("-fxray-instrumentation-bundle=", A, Args,
Diags, Opts.XRayInstrumentationBundle);
- Opts.PatchableFunctionEntryCount =
- getLastArgIntValue(Args, OPT_fpatchable_function_entry_EQ, 0, Diags);
- Opts.PatchableFunctionEntryOffset = getLastArgIntValue(
- Args, OPT_fpatchable_function_entry_offset_EQ, 0, Diags);
-
if (const Arg *A = Args.getLastArg(OPT_fcf_protection_EQ)) {
StringRef Name = A->getValue();
if (Name == "full") {
@@ -1241,8 +1094,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.setCompressDebugSections(DCT);
}
- Opts.DebugCompilationDir =
- std::string(Args.getLastArgValue(OPT_fdebug_compilation_dir));
for (auto *A :
Args.filtered(OPT_mlink_bitcode_file, OPT_mlink_builtin_bitcode)) {
CodeGenOptions::BitcodeFileToLink F;
@@ -1256,14 +1107,10 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
}
Opts.LinkBitcodeFiles.push_back(F);
}
- Opts.SanitizeCoverageType =
- getLastArgIntValue(Args, OPT_fsanitize_coverage_type, 0, Diags);
Opts.SanitizeCoverageAllowlistFiles =
Args.getAllArgValues(OPT_fsanitize_coverage_allowlist);
Opts.SanitizeCoverageBlocklistFiles =
Args.getAllArgValues(OPT_fsanitize_coverage_blocklist);
- Opts.SanitizeMemoryTrackOrigins =
- getLastArgIntValue(Args, OPT_fsanitize_memory_track_origins_EQ, 0, Diags);
Opts.SSPBufferSize =
getLastArgIntValue(Args, OPT_stack_protector_buffer_size, 8, Diags);
@@ -1281,36 +1128,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
std::string(Args.getLastArgValue(OPT_mstack_protector_guard_reg_EQ,
"none"));
- if (Arg *A = Args.getLastArg(OPT_mstack_alignment)) {
- StringRef Val = A->getValue();
- unsigned StackAlignment = Opts.StackAlignment;
- Val.getAsInteger(10, StackAlignment);
- Opts.StackAlignment = StackAlignment;
- }
-
- if (Arg *A = Args.getLastArg(OPT_mstack_probe_size)) {
- StringRef Val = A->getValue();
- unsigned StackProbeSize = Opts.StackProbeSize;
- Val.getAsInteger(0, StackProbeSize);
- Opts.StackProbeSize = StackProbeSize;
- }
-
- if (Arg *A = Args.getLastArg(OPT_fobjc_dispatch_method_EQ)) {
- StringRef Name = A->getValue();
- unsigned Method = llvm::StringSwitch<unsigned>(Name)
- .Case("legacy", CodeGenOptions::Legacy)
- .Case("non-legacy", CodeGenOptions::NonLegacy)
- .Case("mixed", CodeGenOptions::Mixed)
- .Default(~0U);
- if (Method == ~0U) {
- Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
- Success = false;
- } else {
- Opts.setObjCDispatchMethod(
- static_cast<CodeGenOptions::ObjCDispatchMethodKind>(Method));
- }
- }
-
if (Args.getLastArg(OPT_femulated_tls) ||
Args.getLastArg(OPT_fno_emulated_tls)) {
@@ -1319,24 +1136,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Args.hasFlag(OPT_femulated_tls, OPT_fno_emulated_tls, false);
}
- if (Arg *A = Args.getLastArg(OPT_ftlsmodel_EQ)) {
- StringRef Name = A->getValue();
- unsigned Model = llvm::StringSwitch<unsigned>(Name)
- .Case("global-dynamic", CodeGenOptions::GeneralDynamicTLSModel)
- .Case("local-dynamic", CodeGenOptions::LocalDynamicTLSModel)
- .Case("initial-exec", CodeGenOptions::InitialExecTLSModel)
- .Case("local-exec", CodeGenOptions::LocalExecTLSModel)
- .Default(~0U);
- if (Model == ~0U) {
- Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
- Success = false;
- } else {
- Opts.setDefaultTLSModel(static_cast<CodeGenOptions::TLSModel>(Model));
- }
- }
-
- Opts.TLSSize = getLastArgIntValue(Args, OPT_mtls_size_EQ, 0, Diags);
-
if (Arg *A = Args.getLastArg(OPT_fdenormal_fp_math_EQ)) {
StringRef Val = A->getValue();
Opts.FPDenormalMode = llvm::parseDenormalFPAttribute(Val);
@@ -1397,7 +1196,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.LinkerOptions = Args.getAllArgValues(OPT_linker_option);
bool NeedLocTracking = false;
- Opts.OptRecordFile = std::string(Args.getLastArgValue(OPT_opt_record_file));
if (!Opts.OptRecordFile.empty())
NeedLocTracking = true;
@@ -1480,21 +1278,12 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Args.getAllArgValues(OPT_fsanitize_trap_EQ), Diags,
Opts.SanitizeTrap);
- Opts.CudaGpuBinaryFileName =
- std::string(Args.getLastArgValue(OPT_fcuda_include_gpubinary));
-
- Opts.EmitCheckPathComponentsToStrip = getLastArgIntValue(
- Args, OPT_fsanitize_undefined_strip_path_components_EQ, 0, Diags);
-
Opts.EmitVersionIdentMetadata = Args.hasFlag(OPT_Qy, OPT_Qn, true);
Opts.DefaultFunctionAttrs = Args.getAllArgValues(OPT_default_function_attr);
Opts.PassPlugins = Args.getAllArgValues(OPT_fpass_plugin_EQ);
- Opts.SymbolPartition =
- std::string(Args.getLastArgValue(OPT_fsymbol_partition_EQ));
-
return Success;
}
diff --git a/clang/test/Profile/c-generate.c b/clang/test/Profile/c-generate.c
index 1e7a739e04e4..70ab757e6471 100644
--- a/clang/test/Profile/c-generate.c
+++ b/clang/test/Profile/c-generate.c
@@ -7,7 +7,7 @@
//
// PROF-INSTR-NONE-NOT: __llvm_prf
//
-// PROF-INSTR-GARBAGE: invalid PGO instrumentor in argument '-fprofile-instrument=garbage'
+// PROF-INSTR-GARBAGE: invalid value 'garbage' in '-fprofile-instrument=garbage'
int main(void) {
return 0;
More information about the llvm-branch-commits
mailing list