@@ -241,6 +241,8 @@ def mno_mpx : Flag<["-"], "mno-mpx">, Group<clang_ignored_legacy_options_Group>;
241
241
def clang_ignored_gcc_optimization_f_Group : OptionGroup<
242
242
"<clang_ignored_gcc_optimization_f_Group>">, Group<f_Group>, Flags<[Ignored]>;
243
243
244
+ class IsDiag { string MacroPrefix = "DIAG_"; }
245
+
244
246
// A boolean option which is opt-in in CC1. The positive option exists in CC1 and
245
247
// Args.hasArg(OPT_ffoo) is used to check that the flag is enabled.
246
248
// This is useful if the option is usually disabled.
@@ -755,7 +757,7 @@ def Wp_COMMA : CommaJoined<["-"], "Wp,">,
755
757
def Wundef_prefix_EQ : CommaJoined<["-"], "Wundef-prefix=">, Group<W_value_Group>,
756
758
Flags<[CC1Option, CoreOption, HelpHidden]>, MetaVarName<"<arg>">,
757
759
HelpText<"Enable warnings for undefined macros with a prefix in the comma separated list <arg>">,
758
- MarshallingInfoStringVector<"DiagnosticOpts-> UndefPrefixes">;
760
+ MarshallingInfoStringVector<"UndefPrefixes">, IsDiag ;
759
761
def Wwrite_strings : Flag<["-"], "Wwrite-strings">, Group<W_Group>, Flags<[CC1Option, HelpHidden]>;
760
762
def Wno_write_strings : Flag<["-"], "Wno-write-strings">, Group<W_Group>, Flags<[CC1Option, HelpHidden]>;
761
763
def W_Joined : Joined<["-"], "W">, Group<W_Group>, Flags<[CC1Option, CoreOption]>,
@@ -1188,7 +1190,9 @@ defm borland_extensions : BoolFOption<"borland-extensions",
1188
1190
def fbuiltin : Flag<["-"], "fbuiltin">, Group<f_Group>, Flags<[CoreOption]>;
1189
1191
def fbuiltin_module_map : Flag <["-"], "fbuiltin-module-map">, Group<f_Group>,
1190
1192
Flags<[NoXarchOption]>, HelpText<"Load the clang builtins module map file.">;
1191
- defm caret_diagnostics : OptOutFFlag<"caret-diagnostics", "", "">;
1193
+ defm caret_diagnostics : BoolFOption<"caret-diagnostics",
1194
+ "ShowCarets", DefaultsToTrue,
1195
+ ChangedBy<NegFlag>, ResetBy<PosFlag>>, IsDiag;
1192
1196
def fclang_abi_compat_EQ : Joined<["-"], "fclang-abi-compat=">, Group<f_clang_Group>,
1193
1197
Flags<[CC1Option]>, MetaVarName<"<version>">, Values<"<major>.<minor>,latest">,
1194
1198
HelpText<"Attempt to match the ABI of Clang <version>">;
@@ -1200,7 +1204,7 @@ def fdiagnostics_color : Flag<["-"], "fdiagnostics-color">, Group<f_Group>,
1200
1204
def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group<f_Group>;
1201
1205
def fansi_escape_codes : Flag<["-"], "fansi-escape-codes">, Group<f_Group>,
1202
1206
Flags<[CoreOption, CC1Option]>, HelpText<"Use ANSI escape codes for diagnostics">,
1203
- MarshallingInfoFlag<"DiagnosticOpts-> UseANSIEscapeCodes">;
1207
+ MarshallingInfoFlag<"UseANSIEscapeCodes">, IsDiag ;
1204
1208
def fcomment_block_commands : CommaJoined<["-"], "fcomment-block-commands=">, Group<f_clang_Group>, Flags<[CC1Option]>,
1205
1209
HelpText<"Treat each comma separated argument in <arg> as a documentation comment block command">,
1206
1210
MetaVarName<"<arg>">, MarshallingInfoStringVector<"LangOpts->CommentOpts.BlockCommandNames">;
@@ -1253,11 +1257,16 @@ def fdebug_pass_structure : Flag<["-"], "fdebug-pass-structure">, Group<f_Group>
1253
1257
def fdepfile_entry : Joined<["-"], "fdepfile-entry=">,
1254
1258
Group<f_clang_Group>, Flags<[CC1Option]>;
1255
1259
def fdiagnostics_fixit_info : Flag<["-"], "fdiagnostics-fixit-info">, Group<f_clang_Group>;
1260
+ def fno_diagnostics_fixit_info : Flag<["-"], "fno-diagnostics-fixit-info">, Group<f_Group>,
1261
+ Flags<[CC1Option]>, HelpText<"Do not include fixit information in diagnostics">,
1262
+ MarshallingInfoNegativeFlag<"ShowFixits">, IsDiag;
1256
1263
def fdiagnostics_parseable_fixits : Flag<["-"], "fdiagnostics-parseable-fixits">, Group<f_clang_Group>,
1257
- Flags<[CoreOption, CC1Option]>, HelpText<"Print fix-its in machine parseable form">;
1264
+ Flags<[CoreOption, CC1Option]>, HelpText<"Print fix-its in machine parseable form">,
1265
+ MarshallingInfoFlag<"ShowParseableFixits">, IsDiag;
1258
1266
def fdiagnostics_print_source_range_info : Flag<["-"], "fdiagnostics-print-source-range-info">,
1259
1267
Group<f_clang_Group>, Flags<[CC1Option]>,
1260
- HelpText<"Print source range spans in numeric form">;
1268
+ HelpText<"Print source range spans in numeric form">,
1269
+ MarshallingInfoFlag<"ShowSourceRanges">, IsDiag;
1261
1270
defm diagnostics_show_hotness : BoolFOption<"diagnostics-show-hotness",
1262
1271
"CodeGenOpts.DiagnosticsWithHotness", DefaultsToFalse,
1263
1272
ChangedBy<PosFlag, [], "Enable profile hotness information in diagnostic line">,
@@ -1266,15 +1275,19 @@ def fdiagnostics_hotness_threshold_EQ : Joined<["-"], "fdiagnostics-hotness-thre
1266
1275
Group<f_Group>, Flags<[CC1Option]>, MetaVarName<"<value>">,
1267
1276
HelpText<"Prevent optimization remarks from being output if they do not have at least this profile count. "
1268
1277
"Use 'auto' to apply the threshold from profile summary">;
1269
- def fdiagnostics_show_option : Flag<["-"], "fdiagnostics-show-option">, Group<f_Group>,
1270
- HelpText<"Print option name with mappable diagnostics">;
1271
- def fdiagnostics_show_note_include_stack : Flag<["-"], "fdiagnostics-show-note-include-stack">,
1272
- Group<f_Group>, Flags<[CC1Option]>, HelpText<"Display include stacks for diagnostic notes">;
1278
+ defm diagnostics_show_option : BoolFOption<"diagnostics-show-option",
1279
+ "ShowOptionNames", DefaultsToTrue,
1280
+ ChangedBy<NegFlag>, ResetBy<PosFlag, [], "Print option name with mappable diagnostics">>, IsDiag;
1281
+ defm diagnostics_show_note_include_stack : BoolFOption<"diagnostics-show-note-include-stack",
1282
+ "ShowNoteIncludeStack", DefaultsToFalse,
1283
+ ChangedBy<PosFlag, [], "Display include stacks for diagnostic notes">,
1284
+ ResetBy<NegFlag>, BothFlags<[CC1Option]>>, IsDiag;
1273
1285
def fdiagnostics_format_EQ : Joined<["-"], "fdiagnostics-format=">, Group<f_clang_Group>;
1274
1286
def fdiagnostics_show_category_EQ : Joined<["-"], "fdiagnostics-show-category=">, Group<f_clang_Group>;
1275
1287
def fdiagnostics_show_template_tree : Flag<["-"], "fdiagnostics-show-template-tree">,
1276
1288
Group<f_Group>, Flags<[CC1Option]>,
1277
- HelpText<"Print a template comparison tree for differing templates">;
1289
+ HelpText<"Print a template comparison tree for differing templates">,
1290
+ MarshallingInfoFlag<"ShowTemplateTree">, IsDiag;
1278
1291
def fdeclspec : Flag<["-"], "fdeclspec">, Group<f_clang_Group>,
1279
1292
HelpText<"Allow __declspec as a keyword">, Flags<[CC1Option]>;
1280
1293
def fdiscard_value_names : Flag<["-"], "fdiscard-value-names">, Group<f_clang_Group>,
@@ -1294,7 +1307,8 @@ defm elide_constructors : BoolFOption<"elide-constructors",
1294
1307
ResetBy<PosFlag>>;
1295
1308
def fno_elide_type : Flag<["-"], "fno-elide-type">, Group<f_Group>,
1296
1309
Flags<[CC1Option]>,
1297
- HelpText<"Do not elide types when printing diagnostics">;
1310
+ HelpText<"Do not elide types when printing diagnostics">,
1311
+ MarshallingInfoNegativeFlag<"ElideType">, IsDiag;
1298
1312
def feliminate_unused_debug_symbols : Flag<["-"], "feliminate-unused-debug-symbols">, Group<f_Group>;
1299
1313
defm eliminate_unused_debug_types : OptOutFFlag<"eliminate-unused-debug-types",
1300
1314
"Do not emit ", "Emit ", " debug info for defined but unused types">;
@@ -1798,7 +1812,8 @@ defm merge_all_constants : BoolFOption<"merge-all-constants",
1798
1812
ChangedBy<PosFlag, [CoreOption], "Allow">, ResetBy<NegFlag, [], "Disallow">,
1799
1813
BothFlags<[], " merging of constants">>;
1800
1814
def fmessage_length_EQ : Joined<["-"], "fmessage-length=">, Group<f_Group>, Flags<[CC1Option]>,
1801
- HelpText<"Format message diagnostics so that they fit within N columns">;
1815
+ HelpText<"Format message diagnostics so that they fit within N columns">,
1816
+ MarshallingInfoStringInt<"MessageLength">, IsDiag;
1802
1817
def fms_extensions : Flag<["-"], "fms-extensions">, Group<f_Group>, Flags<[CC1Option, CoreOption]>,
1803
1818
HelpText<"Accept some non-standard constructs supported by the Microsoft compiler">;
1804
1819
def fms_compatibility : Flag<["-"], "fms-compatibility">, Group<f_Group>, Flags<[CC1Option, CoreOption]>,
@@ -1965,11 +1980,6 @@ def fno_common : Flag<["-"], "fno-common">, Group<f_Group>, Flags<[CC1Option]>,
1965
1980
HelpText<"Compile common globals like normal definitions">;
1966
1981
def fno_cxx_modules : Flag <["-"], "fno-cxx-modules">, Group<f_Group>,
1967
1982
Flags<[NoXarchOption]>;
1968
- def fno_diagnostics_fixit_info : Flag<["-"], "fno-diagnostics-fixit-info">, Group<f_Group>,
1969
- Flags<[CC1Option]>, HelpText<"Do not include fixit information in diagnostics">;
1970
- def fno_diagnostics_show_option : Flag<["-"], "fno-diagnostics-show-option">, Group<f_Group>, Flags<[CC1Option]>;
1971
- def fno_diagnostics_show_note_include_stack : Flag<["-"], "fno-diagnostics-show-note-include-stack">,
1972
- Flags<[CC1Option]>, Group<f_Group>;
1973
1983
def fdigraphs : Flag<["-"], "fdigraphs">, Group<f_Group>, Flags<[CC1Option]>,
1974
1984
HelpText<"Enable alternative token representations '<:', ':>', '<%', '%>', '%:', '%:%:' (default)">;
1975
1985
def fno_digraphs : Flag<["-"], "fno-digraphs">, Group<f_Group>, Flags<[CC1Option]>,
@@ -2017,10 +2027,9 @@ def fno_omit_frame_pointer : Flag<["-"], "fno-omit-frame-pointer">, Group<f_Grou
2017
2027
def fno_operator_names : Flag<["-"], "fno-operator-names">, Group<f_Group>,
2018
2028
HelpText<"Do not treat C++ operator name keywords as synonyms for operators">,
2019
2029
Flags<[CC1Option]>;
2020
- def fno_show_source_location : Flag<["-"], "fno-show-source-location">, Group<f_Group>,
2021
- Flags<[CC1Option]>, HelpText<"Do not include source location information with diagnostics">;
2022
2030
def fdiagnostics_absolute_paths : Flag<["-"], "fdiagnostics-absolute-paths">, Group<f_Group>,
2023
- Flags<[CC1Option, CoreOption]>, HelpText<"Print absolute paths in diagnostics">;
2031
+ Flags<[CC1Option, CoreOption]>, HelpText<"Print absolute paths in diagnostics">,
2032
+ MarshallingInfoFlag<"AbsolutePath">, IsDiag;
2024
2033
def fno_stack_protector : Flag<["-"], "fno-stack-protector">, Group<f_Group>,
2025
2034
HelpText<"Disable the use of stack protectors">;
2026
2035
def fno_strict_aliasing : Flag<["-"], "fno-strict-aliasing">, Group<f_Group>,
@@ -2231,9 +2240,17 @@ def fno_short_wchar : Flag<["-"], "fno-short-wchar">, Group<f_Group>,
2231
2240
HelpText<"Force wchar_t to be an unsigned int">;
2232
2241
def fshow_overloads_EQ : Joined<["-"], "fshow-overloads=">, Group<f_Group>, Flags<[CC1Option]>,
2233
2242
HelpText<"Which overload candidates to show when overload resolution fails: "
2234
- "best|all; defaults to all">, Values<"best,all">;
2235
- defm show_column : OptOutFFlag<"show-column", "", "Do not include column number on diagnostics">;
2236
- def fshow_source_location : Flag<["-"], "fshow-source-location">, Group<f_Group>;
2243
+ "best|all; defaults to all">, Values<"best,all">,
2244
+ NormalizedValues<["Ovl_Best", "Ovl_All"]>,
2245
+ MarshallingInfoString<"ShowOverloads", "Ovl_All">, AutoNormalizeEnum, IsDiag;
2246
+ defm show_column : BoolFOption<"show-column",
2247
+ "ShowColumn", DefaultsToTrue,
2248
+ ChangedBy<NegFlag, [], "Do not include column number on diagnostics">,
2249
+ ResetBy<PosFlag>>, IsDiag;
2250
+ defm show_source_location : BoolFOption<"show-source-location",
2251
+ "ShowLocation", DefaultsToTrue,
2252
+ ChangedBy<NegFlag, [], "Do not include source location information with diagnostics">,
2253
+ ResetBy<PosFlag>>, IsDiag;
2237
2254
defm spell_checking : BoolFOption<"spell-checking",
2238
2255
"LangOpts->SpellChecking", DefaultsToTrue,
2239
2256
ChangedBy<NegFlag, [], "Disable spell-checking">, ResetBy<PosFlag>>;
@@ -3359,8 +3376,10 @@ def o : JoinedOrSeparate<["-"], "o">, Flags<[NoXarchOption, RenderAsInput,
3359
3376
MarshallingInfoString<"FrontendOpts.OutputFile">;
3360
3377
def pagezero__size : JoinedOrSeparate<["-"], "pagezero_size">;
3361
3378
def pass_exit_codes : Flag<["-", "--"], "pass-exit-codes">, Flags<[Unsupported]>;
3362
- def pedantic_errors : Flag<["-", "--"], "pedantic-errors">, Group<pedantic_Group>, Flags<[CC1Option]>;
3363
- def pedantic : Flag<["-", "--"], "pedantic">, Group<pedantic_Group>, Flags<[CC1Option]>;
3379
+ def pedantic_errors : Flag<["-", "--"], "pedantic-errors">, Group<pedantic_Group>, Flags<[CC1Option]>,
3380
+ MarshallingInfoFlag<"PedanticErrors">, IsDiag;
3381
+ def pedantic : Flag<["-", "--"], "pedantic">, Group<pedantic_Group>, Flags<[CC1Option]>,
3382
+ MarshallingInfoFlag<"Pedantic">, IsDiag;
3364
3383
def pg : Flag<["-"], "pg">, HelpText<"Enable mcount instrumentation">, Flags<[CC1Option]>,
3365
3384
MarshallingInfoFlag<"CodeGenOpts.InstrumentForProfiling">;
3366
3385
def pipe : Flag<["-", "--"], "pipe">,
@@ -3528,7 +3547,8 @@ def weak__library : Separate<["-"], "weak_library">, Flags<[LinkerInput]>;
3528
3547
def weak__reference__mismatches : Separate<["-"], "weak_reference_mismatches">;
3529
3548
def whatsloaded : Flag<["-"], "whatsloaded">;
3530
3549
def whyload : Flag<["-"], "whyload">;
3531
- def w : Flag<["-"], "w">, HelpText<"Suppress all warnings">, Flags<[CC1Option]>;
3550
+ def w : Flag<["-"], "w">, HelpText<"Suppress all warnings">, Flags<[CC1Option]>,
3551
+ MarshallingInfoFlag<"IgnoreWarnings">, IsDiag;
3532
3552
def x : JoinedOrSeparate<["-"], "x">, Flags<[NoXarchOption,CC1Option]>,
3533
3553
HelpText<"Treat subsequent input files as having type <language>">,
3534
3554
MetaVarName<"<language>">;
@@ -4646,45 +4666,59 @@ def show_includes : Flag<["--"], "show-includes">,
4646
4666
//===----------------------------------------------------------------------===//
4647
4667
4648
4668
def diagnostic_log_file : Separate<["-"], "diagnostic-log-file">,
4649
- HelpText<"Filename (or -) to log diagnostics to">;
4669
+ HelpText<"Filename (or -) to log diagnostics to">,
4670
+ MarshallingInfoString<"DiagnosticLogFile">, IsDiag;
4650
4671
def diagnostic_serialized_file : Separate<["-"], "serialize-diagnostic-file">,
4651
4672
MetaVarName<"<filename>">,
4652
4673
HelpText<"File for serializing diagnostics in a binary format">;
4653
4674
4654
4675
def fdiagnostics_format : Separate<["-"], "fdiagnostics-format">,
4655
- HelpText<"Change diagnostic formatting to match IDE and command line tools">, Values<"clang,msvc,msvc-fallback,vi">;
4676
+ HelpText<"Change diagnostic formatting to match IDE and command line tools">, Values<"clang,msvc,msvc-fallback,vi">,
4677
+ NormalizedValuesScope<"DiagnosticOptions">, NormalizedValues<["Clang", "MSVC", "MSVC", "Vi"]>,
4678
+ MarshallingInfoString<"Format", "Clang">, AutoNormalizeEnum, IsDiag;
4656
4679
def fdiagnostics_show_category : Separate<["-"], "fdiagnostics-show-category">,
4657
- HelpText<"Print diagnostic category">, Values<"none,id,name">;
4680
+ HelpText<"Print diagnostic category">, Values<"none,id,name">,
4681
+ NormalizedValues<["0", "1", "2"]>,
4682
+ MarshallingInfoString<"ShowCategories", "0">, AutoNormalizeEnum, IsDiag;
4658
4683
def fno_diagnostics_use_presumed_location : Flag<["-"], "fno-diagnostics-use-presumed-location">,
4659
- HelpText<"Ignore #line directives when displaying diagnostic locations">;
4684
+ HelpText<"Ignore #line directives when displaying diagnostic locations">,
4685
+ MarshallingInfoNegativeFlag<"ShowPresumedLoc">, IsDiag;
4660
4686
def ftabstop : Separate<["-"], "ftabstop">, MetaVarName<"<N>">,
4661
- HelpText<"Set the tab stop distance.">;
4687
+ HelpText<"Set the tab stop distance.">,
4688
+ MarshallingInfoStringInt<"TabStop", "DiagnosticOptions::DefaultTabStop">, IsDiag;
4662
4689
def ferror_limit : Separate<["-"], "ferror-limit">, MetaVarName<"<N>">,
4663
- HelpText<"Set the maximum number of errors to emit before stopping (0 = no limit).">;
4690
+ HelpText<"Set the maximum number of errors to emit before stopping (0 = no limit).">,
4691
+ MarshallingInfoStringInt<"ErrorLimit">, IsDiag;
4664
4692
def fmacro_backtrace_limit : Separate<["-"], "fmacro-backtrace-limit">, MetaVarName<"<N>">,
4665
- HelpText<"Set the maximum number of entries to print in a macro expansion backtrace (0 = no limit).">;
4693
+ HelpText<"Set the maximum number of entries to print in a macro expansion backtrace (0 = no limit).">,
4694
+ MarshallingInfoStringInt<"MacroBacktraceLimit", "DiagnosticOptions::DefaultMacroBacktraceLimit">, IsDiag;
4666
4695
def ftemplate_backtrace_limit : Separate<["-"], "ftemplate-backtrace-limit">, MetaVarName<"<N>">,
4667
- HelpText<"Set the maximum number of entries to print in a template instantiation backtrace (0 = no limit).">;
4696
+ HelpText<"Set the maximum number of entries to print in a template instantiation backtrace (0 = no limit).">,
4697
+ MarshallingInfoStringInt<"TemplateBacktraceLimit", "DiagnosticOptions::DefaultTemplateBacktraceLimit">, IsDiag;
4668
4698
def fconstexpr_backtrace_limit : Separate<["-"], "fconstexpr-backtrace-limit">, MetaVarName<"<N>">,
4669
- HelpText<"Set the maximum number of entries to print in a constexpr evaluation backtrace (0 = no limit).">;
4699
+ HelpText<"Set the maximum number of entries to print in a constexpr evaluation backtrace (0 = no limit).">,
4700
+ MarshallingInfoStringInt<"ConstexprBacktraceLimit", "DiagnosticOptions::DefaultConstexprBacktraceLimit">, IsDiag;
4670
4701
def fspell_checking_limit : Separate<["-"], "fspell-checking-limit">, MetaVarName<"<N>">,
4671
- HelpText<"Set the maximum number of times to perform spell checking on unrecognized identifiers (0 = no limit).">;
4702
+ HelpText<"Set the maximum number of times to perform spell checking on unrecognized identifiers (0 = no limit).">,
4703
+ MarshallingInfoStringInt<"SpellCheckingLimit", "DiagnosticOptions::DefaultSpellCheckingLimit">, IsDiag;
4672
4704
def fcaret_diagnostics_max_lines :
4673
4705
Separate<["-"], "fcaret-diagnostics-max-lines">, MetaVarName<"<N>">,
4674
- HelpText<"Set the maximum number of source lines to show in a caret diagnostic">;
4706
+ HelpText<"Set the maximum number of source lines to show in a caret diagnostic">,
4707
+ MarshallingInfoStringInt<"SnippetLineLimit", "DiagnosticOptions::DefaultSnippetLineLimit">, IsDiag;
4675
4708
def verify_EQ : CommaJoined<["-"], "verify=">,
4676
4709
MetaVarName<"<prefixes>">,
4677
4710
HelpText<"Verify diagnostic output using comment directives that start with"
4678
4711
" prefixes in the comma-separated sequence <prefixes>">,
4679
- MarshallingInfoStringVector<"DiagnosticOpts-> VerifyPrefixes">;
4712
+ MarshallingInfoStringVector<"VerifyPrefixes">, IsDiag ;
4680
4713
def verify : Flag<["-"], "verify">,
4681
4714
HelpText<"Equivalent to -verify=expected">;
4682
4715
def verify_ignore_unexpected : Flag<["-"], "verify-ignore-unexpected">,
4683
4716
HelpText<"Ignore unexpected diagnostic messages">;
4684
4717
def verify_ignore_unexpected_EQ : CommaJoined<["-"], "verify-ignore-unexpected=">,
4685
4718
HelpText<"Ignore unexpected diagnostic messages">;
4686
4719
def Wno_rewrite_macros : Flag<["-"], "Wno-rewrite-macros">,
4687
- HelpText<"Silence ObjC rewriting warnings">;
4720
+ HelpText<"Silence ObjC rewriting warnings">,
4721
+ MarshallingInfoFlag<"NoRewriteMacros">, IsDiag;
4688
4722
4689
4723
//===----------------------------------------------------------------------===//
4690
4724
// Frontend Options
0 commit comments