Skip to content

Commit b6ba598

Browse files
committed
[clang][cli] Port getAllArgumentValues to the marshalling infrastructure
Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D93679
1 parent e5cdb6c commit b6ba598

File tree

2 files changed

+55
-58
lines changed

2 files changed

+55
-58
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,8 @@ def MP : Flag<["-"], "MP">, Group<M_Group>, Flags<[CC1Option]>,
679679
def MQ : JoinedOrSeparate<["-"], "MQ">, Group<M_Group>, Flags<[CC1Option]>,
680680
HelpText<"Specify name of main file output to quote in depfile">;
681681
def MT : JoinedOrSeparate<["-"], "MT">, Group<M_Group>, Flags<[CC1Option]>,
682-
HelpText<"Specify name of main file output in depfile">;
682+
HelpText<"Specify name of main file output in depfile">,
683+
MarshallingInfoStringVector<"DependencyOutputOpts.Targets">;
683684
def MV : Flag<["-"], "MV">, Group<M_Group>, Flags<[CC1Option]>,
684685
HelpText<"Use NMake/Jom format for the depfile">,
685686
MarshallingInfoFlag<"DependencyOutputOpts.OutputFormat", "DependencyOutputFormat::Make">,
@@ -753,7 +754,8 @@ def Wp_COMMA : CommaJoined<["-"], "Wp,">,
753754
MetaVarName<"<arg>">, Group<Preprocessor_Group>;
754755
def Wundef_prefix_EQ : CommaJoined<["-"], "Wundef-prefix=">, Group<W_value_Group>,
755756
Flags<[CC1Option, CoreOption, HelpHidden]>, MetaVarName<"<arg>">,
756-
HelpText<"Enable warnings for undefined macros with a prefix in the comma separated list <arg>">;
757+
HelpText<"Enable warnings for undefined macros with a prefix in the comma separated list <arg>">,
758+
MarshallingInfoStringVector<"DiagnosticOpts->UndefPrefixes">;
757759
def Wwrite_strings : Flag<["-"], "Wwrite-strings">, Group<W_Group>, Flags<[CC1Option, HelpHidden]>;
758760
def Wno_write_strings : Flag<["-"], "Wno-write-strings">, Group<W_Group>, Flags<[CC1Option, HelpHidden]>;
759761
def W_Joined : Joined<["-"], "W">, Group<W_Group>, Flags<[CC1Option, CoreOption]>,
@@ -1387,7 +1389,8 @@ def fno_sanitize_EQ : CommaJoined<["-"], "fno-sanitize=">, Group<f_clang_Group>,
13871389
Flags<[CoreOption, NoXarchOption]>;
13881390
def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">,
13891391
Group<f_clang_Group>,
1390-
HelpText<"Path to blacklist file for sanitizers">;
1392+
HelpText<"Path to blacklist file for sanitizers">,
1393+
MarshallingInfoStringVector<"LangOpts->SanitizerBlacklistFiles">;
13911394
def fsanitize_system_blacklist : Joined<["-"], "fsanitize-system-blacklist=">,
13921395
HelpText<"Path to system blacklist file for sanitizers">,
13931396
Flags<[CC1Option]>;
@@ -1405,13 +1408,15 @@ def fno_sanitize_coverage
14051408
"Sanitizers">, Values<"func,bb,edge,indirect-calls,trace-bb,trace-cmp,trace-div,trace-gep,8bit-counters,trace-pc,trace-pc-guard,no-prune,inline-8bit-counters,inline-bool-flag">;
14061409
def fsanitize_coverage_allowlist : Joined<["-"], "fsanitize-coverage-allowlist=">,
14071410
Group<f_clang_Group>, Flags<[CoreOption, NoXarchOption]>,
1408-
HelpText<"Restrict sanitizer coverage instrumentation exclusively to modules and functions that match the provided special case list, except the blocked ones">;
1411+
HelpText<"Restrict sanitizer coverage instrumentation exclusively to modules and functions that match the provided special case list, except the blocked ones">,
1412+
MarshallingInfoStringVector<"CodeGenOpts.SanitizeCoverageAllowlistFiles">;
14091413
def : Joined<["-"], "fsanitize-coverage-whitelist=">,
14101414
Group<f_clang_Group>, Flags<[CoreOption, HelpHidden]>, Alias<fsanitize_coverage_allowlist>,
14111415
HelpText<"Deprecated, use -fsanitize-coverage-allowlist= instead">;
14121416
def fsanitize_coverage_blocklist : Joined<["-"], "fsanitize-coverage-blocklist=">,
14131417
Group<f_clang_Group>, Flags<[CoreOption, NoXarchOption]>,
1414-
HelpText<"Disable sanitizer coverage instrumentation for modules and functions that match the provided special case list, even the allowed ones">;
1418+
HelpText<"Disable sanitizer coverage instrumentation for modules and functions that match the provided special case list, even the allowed ones">,
1419+
MarshallingInfoStringVector<"CodeGenOpts.SanitizeCoverageBlocklistFiles">;
14151420
def : Joined<["-"], "fsanitize-coverage-blacklist=">,
14161421
Group<f_clang_Group>, Flags<[CoreOption, HelpHidden]>, Alias<fsanitize_coverage_blocklist>,
14171422
HelpText<"Deprecated, use -fsanitize-coverage-blocklist= instead">;
@@ -1616,7 +1621,8 @@ defm delete_null_pointer_checks : BoolFOption<"delete-null-pointer-checks",
16161621

16171622
def frewrite_map_file : Separate<["-"], "frewrite-map-file">,
16181623
Group<f_Group>,
1619-
Flags<[ NoXarchOption, CC1Option ]>;
1624+
Flags<[ NoXarchOption, CC1Option ]>,
1625+
MarshallingInfoStringVector<"CodeGenOpts.RewriteMapFiles">;
16201626
def frewrite_map_file_EQ : Joined<["-"], "frewrite-map-file=">,
16211627
Group<f_Group>,
16221628
Flags<[NoXarchOption]>;
@@ -1694,15 +1700,18 @@ def fxray_instruction_threshold_ :
16941700
def fxray_always_instrument :
16951701
JoinedOrSeparate<["-"], "fxray-always-instrument=">,
16961702
Group<f_Group>, Flags<[CC1Option]>,
1697-
HelpText<"DEPRECATED: Filename defining the whitelist for imbuing the 'always instrument' XRay attribute.">;
1703+
HelpText<"DEPRECATED: Filename defining the whitelist for imbuing the 'always instrument' XRay attribute.">,
1704+
MarshallingInfoStringVector<"LangOpts->XRayAlwaysInstrumentFiles">;
16981705
def fxray_never_instrument :
16991706
JoinedOrSeparate<["-"], "fxray-never-instrument=">,
17001707
Group<f_Group>, Flags<[CC1Option]>,
1701-
HelpText<"DEPRECATED: Filename defining the whitelist for imbuing the 'never instrument' XRay attribute.">;
1708+
HelpText<"DEPRECATED: Filename defining the whitelist for imbuing the 'never instrument' XRay attribute.">,
1709+
MarshallingInfoStringVector<"LangOpts->XRayNeverInstrumentFiles">;
17021710
def fxray_attr_list :
17031711
JoinedOrSeparate<["-"], "fxray-attr-list=">,
17041712
Group<f_Group>, Flags<[CC1Option]>,
1705-
HelpText<"Filename defining the list of functions/types for imbuing XRay attributes.">;
1713+
HelpText<"Filename defining the list of functions/types for imbuing XRay attributes.">,
1714+
MarshallingInfoStringVector<"LangOpts->XRayAttrListFiles">;
17061715
def fxray_modes :
17071716
JoinedOrSeparate<["-"], "fxray-modes=">,
17081717
Group<f_Group>, Flags<[CC1Option]>,
@@ -2191,7 +2200,8 @@ def fplugin_EQ : Joined<["-"], "fplugin=">, Group<f_Group>, Flags<[NoXarchOption
21912200
HelpText<"Load the named plugin (dynamic shared object)">;
21922201
def fpass_plugin_EQ : Joined<["-"], "fpass-plugin=">,
21932202
Group<f_Group>, Flags<[CC1Option]>, MetaVarName<"<dsopath>">,
2194-
HelpText<"Load pass plugin from a dynamic shared object file (only with new pass manager).">;
2203+
HelpText<"Load pass plugin from a dynamic shared object file (only with new pass manager).">,
2204+
MarshallingInfoStringVector<"CodeGenOpts.PassPlugins">;
21952205
defm preserve_as_comments : BoolFOption<"preserve-as-comments",
21962206
"CodeGenOpts.PreserveAsmComments", DefaultsToTrue,
21972207
ChangedBy<NegFlag, [], "Do not preserve comments in inline assembly">,
@@ -2639,7 +2649,8 @@ def iframeworkwithsysroot : JoinedOrSeparate<["-"], "iframeworkwithsysroot">,
26392649
"absolute paths are relative to -isysroot">,
26402650
MetaVarName<"<directory>">, Flags<[CC1Option]>;
26412651
def imacros : JoinedOrSeparate<["-", "--"], "imacros">, Group<clang_i_Group>, Flags<[CC1Option]>,
2642-
HelpText<"Include macros from file before parsing">, MetaVarName<"<file>">;
2652+
HelpText<"Include macros from file before parsing">, MetaVarName<"<file>">,
2653+
MarshallingInfoStringVector<"PreprocessorOpts->MacroIncludes">;
26432654
def image__base : Separate<["-"], "image_base">;
26442655
def include_ : JoinedOrSeparate<["-", "--"], "include">, Group<clang_i_Group>, EnumName<"include">,
26452656
MetaVarName<"<file>">, HelpText<"Include file before parsing">, Flags<[CC1Option]>;
@@ -2786,7 +2797,8 @@ def mkernel : Flag<["-"], "mkernel">, Group<m_Group>;
27862797
def mlinker_version_EQ : Joined<["-"], "mlinker-version=">,
27872798
Flags<[NoXarchOption]>;
27882799
def mllvm : Separate<["-"], "mllvm">, Flags<[CC1Option,CC1AsOption,CoreOption]>,
2789-
HelpText<"Additional arguments to forward to LLVM's option processing">;
2800+
HelpText<"Additional arguments to forward to LLVM's option processing">,
2801+
MarshallingInfoStringVector<"FrontendOpts.LLVMArgs">;
27902802
def mmacosx_version_min_EQ : Joined<["-"], "mmacosx-version-min=">,
27912803
Group<m_Group>, HelpText<"Set Mac OS X deployment target">;
27922804
def mmacos_version_min_EQ : Joined<["-"], "mmacos-version-min=">,
@@ -3124,7 +3136,8 @@ def mno_implicit_float : Flag<["-"], "mno-implicit-float">, Group<m_Group>,
31243136
HelpText<"Don't generate implicit floating point instructions">;
31253137
def mimplicit_float : Flag<["-"], "mimplicit-float">, Group<m_Group>;
31263138
def mrecip : Flag<["-"], "mrecip">, Group<m_Group>;
3127-
def mrecip_EQ : CommaJoined<["-"], "mrecip=">, Group<m_Group>, Flags<[CC1Option]>;
3139+
def mrecip_EQ : CommaJoined<["-"], "mrecip=">, Group<m_Group>, Flags<[CC1Option]>,
3140+
MarshallingInfoStringVector<"CodeGenOpts.Reciprocals">;
31283141
def mprefer_vector_width_EQ : Joined<["-"], "mprefer-vector-width=">, Group<m_Group>, Flags<[CC1Option]>,
31293142
HelpText<"Specifies preferred vector width for auto-vectorization. Defaults to 'none' which allows target specific decisions.">,
31303143
MarshallingInfoString<"CodeGenOpts.PreferVectorWidth">;
@@ -4120,7 +4133,8 @@ def tune_cpu : Separate<["-"], "tune-cpu">,
41204133
HelpText<"Tune for a specific cpu type">,
41214134
MarshallingInfoString<"TargetOpts->TuneCPU">;
41224135
def target_feature : Separate<["-"], "target-feature">,
4123-
HelpText<"Target specific attributes">;
4136+
HelpText<"Target specific attributes">,
4137+
MarshallingInfoStringVector<"TargetOpts->FeaturesAsWritten">;
41244138
def triple : Separate<["-"], "triple">,
41254139
HelpText<"Specify target triple (e.g. i686-apple-darwin9)">,
41264140
MarshallingInfoString<"TargetOpts->Triple", "llvm::Triple::normalize(llvm::sys::getDefaultTargetTriple())">,
@@ -4323,7 +4337,8 @@ def debug_info_macro : Flag<["-"], "debug-info-macro">,
43234337
HelpText<"Emit macro debug information">,
43244338
MarshallingInfoFlag<"CodeGenOpts.MacroDebugInfo">;
43254339
def default_function_attr : Separate<["-"], "default-function-attr">,
4326-
HelpText<"Apply given attribute to all functions">;
4340+
HelpText<"Apply given attribute to all functions">,
4341+
MarshallingInfoStringVector<"CodeGenOpts.DefaultFunctionAttrs">;
43274342
def dwarf_version_EQ : Joined<["-"], "dwarf-version=">,
43284343
MarshallingInfoStringInt<"CodeGenOpts.DwarfVersion">;
43294344
def debugger_tuning_EQ : Joined<["-"], "debugger-tuning=">,
@@ -4496,9 +4511,11 @@ def vectorize_slp : Flag<["-"], "vectorize-slp">,
44964511
HelpText<"Run the SLP vectorization passes">,
44974512
MarshallingInfoFlag<"CodeGenOpts.VectorizeSLP">;
44984513
def dependent_lib : Joined<["--"], "dependent-lib=">,
4499-
HelpText<"Add dependent library">;
4514+
HelpText<"Add dependent library">,
4515+
MarshallingInfoStringVector<"CodeGenOpts.DependentLibraries">;
45004516
def linker_option : Joined<["--"], "linker-option=">,
4501-
HelpText<"Add linker option">;
4517+
HelpText<"Add linker option">,
4518+
MarshallingInfoStringVector<"CodeGenOpts.LinkerOptions">;
45024519
def fsanitize_coverage_type : Joined<["-"], "fsanitize-coverage-type=">,
45034520
HelpText<"Sanitizer coverage type">,
45044521
MarshallingInfoStringInt<"CodeGenOpts.SanitizeCoverageType">;
@@ -4658,7 +4675,8 @@ def fcaret_diagnostics_max_lines :
46584675
def verify_EQ : CommaJoined<["-"], "verify=">,
46594676
MetaVarName<"<prefixes>">,
46604677
HelpText<"Verify diagnostic output using comment directives that start with"
4661-
" prefixes in the comma-separated sequence <prefixes>">;
4678+
" prefixes in the comma-separated sequence <prefixes>">,
4679+
MarshallingInfoStringVector<"DiagnosticOpts->VerifyPrefixes">;
46624680
def verify : Flag<["-"], "verify">,
46634681
HelpText<"Equivalent to -verify=expected">;
46644682
def verify_ignore_unexpected : Flag<["-"], "verify-ignore-unexpected">,
@@ -4679,7 +4697,8 @@ def cc1as : Flag<["-"], "cc1as">;
46794697

46804698
def ast_merge : Separate<["-"], "ast-merge">,
46814699
MetaVarName<"<ast file>">,
4682-
HelpText<"Merge the given AST file into the translation unit being compiled.">;
4700+
HelpText<"Merge the given AST file into the translation unit being compiled.">,
4701+
MarshallingInfoStringVector<"FrontendOpts.ASTMergeFiles">;
46834702
def aux_target_cpu : Separate<["-"], "aux-target-cpu">,
46844703
HelpText<"Target a specific auxiliary cpu type">;
46854704
def aux_target_feature : Separate<["-"], "aux-target-feature">,
@@ -4746,11 +4765,13 @@ def fmodule_map_file_home_is_cwd : Flag<["-"], "fmodule-map-file-home-is-cwd">,
47464765
MarshallingInfoFlag<"HeaderSearchOpts->ModuleMapFileHomeIsCwd">;
47474766
def fmodule_feature : Separate<["-"], "fmodule-feature">,
47484767
MetaVarName<"<feature>">,
4749-
HelpText<"Enable <feature> in module map requires declarations">;
4768+
HelpText<"Enable <feature> in module map requires declarations">,
4769+
MarshallingInfoStringVector<"LangOpts->ModuleFeatures">;
47504770
def fmodules_embed_file_EQ : Joined<["-"], "fmodules-embed-file=">,
47514771
MetaVarName<"<file>">,
47524772
HelpText<"Embed the contents of the specified file into the module file "
4753-
"being compiled.">;
4773+
"being compiled.">,
4774+
MarshallingInfoStringVector<"FrontendOpts.ModulesEmbedFiles">;
47544775
def fmodules_embed_all_files : Joined<["-"], "fmodules-embed-all-files">,
47554776
HelpText<"Embed the contents of all files read by this compilation into "
47564777
"the produced module file.">,
@@ -5190,7 +5211,8 @@ def disable_pragma_debug_crash : Flag<["-"], "disable-pragma-debug-crash">,
51905211
//===----------------------------------------------------------------------===//
51915212

51925213
def cl_ext_EQ : CommaJoined<["-"], "cl-ext=">,
5193-
HelpText<"OpenCL only. Enable or disable OpenCL extensions. The argument is a comma-separated sequence of one or more extension names, each prefixed by '+' or '-'.">;
5214+
HelpText<"OpenCL only. Enable or disable OpenCL extensions. The argument is a comma-separated sequence of one or more extension names, each prefixed by '+' or '-'.">,
5215+
MarshallingInfoStringVector<"TargetOpts->OpenCLExtensionsAsWritten">;
51945216

51955217
//===----------------------------------------------------------------------===//
51965218
// CUDA Options

0 commit comments

Comments
 (0)