@@ -436,11 +436,13 @@ class MarshallingInfoVisibility<KeyPathAndMacro kpm, code default>
436
436
// Key paths that are constant during parsing of options with the same key path prefix.
437
437
defvar cplusplus = LangOpts<"CPlusPlus">;
438
438
defvar cpp11 = LangOpts<"CPlusPlus11">;
439
+ defvar cpp17 = LangOpts<"CPlusPlus17">;
439
440
defvar cpp20 = LangOpts<"CPlusPlus20">;
440
441
defvar c99 = LangOpts<"C99">;
441
442
defvar c2x = LangOpts<"C2x">;
442
443
defvar lang_std = LangOpts<"LangStd">;
443
444
defvar open_cl = LangOpts<"OpenCL">;
445
+ defvar cuda = LangOpts<"CUDA">;
444
446
defvar render_script = LangOpts<"RenderScript">;
445
447
defvar hip = LangOpts<"HIP">;
446
448
defvar gnu_mode = LangOpts<"GNUMode">;
@@ -993,8 +995,10 @@ defm apple_pragma_pack : BoolFOption<"apple-pragma-pack",
993
995
LangOpts<"ApplePragmaPack">, DefaultFalse,
994
996
PosFlag<SetTrue, [CC1Option], "Enable Apple gcc-compatible #pragma pack handling">,
995
997
NegFlag<SetFalse>>;
996
- def fxl_pragma_pack : Flag<["-"], "fxl-pragma-pack">, Group<f_Group>, Flags<[CC1Option]>,
997
- HelpText<"Enable IBM XL #pragma pack handling">;
998
+ defm xl_pragma_pack : BoolFOption<"xl-pragma-pack",
999
+ LangOpts<"XLPragmaPack">, DefaultFalse,
1000
+ PosFlag<SetTrue, [CC1Option], "Enable IBM XL #pragma pack handling">,
1001
+ NegFlag<SetFalse>>;
998
1002
def shared_libsan : Flag<["-"], "shared-libsan">,
999
1003
HelpText<"Dynamically link the sanitizer runtime">;
1000
1004
def static_libsan : Flag<["-"], "static-libsan">,
@@ -1271,8 +1275,6 @@ def fdiagnostics_show_template_tree : Flag<["-"], "fdiagnostics-show-template-tr
1271
1275
Group<f_Group>, Flags<[CC1Option]>,
1272
1276
HelpText<"Print a template comparison tree for differing templates">,
1273
1277
MarshallingInfoFlag<DiagnosticOpts<"ShowTemplateTree">>;
1274
- def fdeclspec : Flag<["-"], "fdeclspec">, Group<f_clang_Group>,
1275
- HelpText<"Allow __declspec as a keyword">, Flags<[CC1Option]>;
1276
1278
def fdiscard_value_names : Flag<["-"], "fdiscard-value-names">, Group<f_clang_Group>,
1277
1279
HelpText<"Discard value names in LLVM IR">, Flags<[NoXarchOption]>;
1278
1280
def fno_discard_value_names : Flag<["-"], "fno-discard-value-names">, Group<f_clang_Group>,
@@ -1344,14 +1346,21 @@ def fdenormal_fp_math_EQ : Joined<["-"], "fdenormal-fp-math=">, Group<f_Group>,
1344
1346
def ffp_model_EQ : Joined<["-"], "ffp-model=">, Group<f_Group>, Flags<[NoXarchOption]>,
1345
1347
HelpText<"Controls the semantics of floating-point calculations.">;
1346
1348
def ffp_exception_behavior_EQ : Joined<["-"], "ffp-exception-behavior=">, Group<f_Group>, Flags<[CC1Option]>,
1347
- HelpText<"Specifies the exception behavior of floating-point operations.">;
1349
+ HelpText<"Specifies the exception behavior of floating-point operations.">,
1350
+ Values<"ignore,maytrap,strict">, NormalizedValuesScope<"LangOptions">,
1351
+ NormalizedValues<["FPE_Ignore", "FPE_MayTrap", "FPE_Strict"]>,
1352
+ MarshallingInfoString<LangOpts<"FPExceptionMode">, "FPE_Ignore">, AutoNormalizeEnum;
1348
1353
defm fast_math : OptInFFlag<"fast-math", "Allow aggressive, lossy floating-point optimizations", "", "", [],
1349
1354
LangOpts<"FastMath">, [cl_fast_relaxed_math.KeyPath]>;
1350
1355
def menable_unsafe_fp_math : Flag<["-"], "menable-unsafe-fp-math">, Flags<[CC1Option]>,
1351
1356
HelpText<"Allow unsafe floating-point math optimizations which may decrease precision">,
1352
1357
MarshallingInfoFlag<LangOpts<"UnsafeFPMath">>,
1353
1358
ImpliedByAnyOf<[cl_unsafe_math_optimizations.KeyPath, ffast_math.KeyPath]>;
1354
- defm math_errno : OptInFFlag<"math-errno", "Require math functions to indicate errors by setting errno">;
1359
+ defm math_errno : BoolFOption<"math-errno",
1360
+ LangOpts<"MathErrno">, DefaultFalse,
1361
+ PosFlag<SetTrue, [CC1Option], "Require math functions to indicate errors by setting errno">,
1362
+ NegFlag<SetFalse>>,
1363
+ ShouldParseIf<!strconcat("!", open_cl.KeyPath)>;
1355
1364
def fbracket_depth_EQ : Joined<["-"], "fbracket-depth=">, Group<f_Group>, Flags<[CoreOption]>;
1356
1365
def fsignaling_math : Flag<["-"], "fsignaling-math">, Group<f_Group>;
1357
1366
def fno_signaling_math : Flag<["-"], "fno-signaling-math">, Group<f_Group>;
@@ -1850,6 +1859,19 @@ def fms_memptr_rep_EQ : Joined<["-"], "fms-memptr-rep=">, Group<f_Group>, Flags<
1850
1859
"PPTMK_FullGeneralityVirtualInheritance"]>,
1851
1860
MarshallingInfoString<LangOpts<"MSPointerToMemberRepresentationMethod">, "PPTMK_BestCase">,
1852
1861
AutoNormalizeEnum;
1862
+ // __declspec is enabled by default for the PS4 by the driver, and also
1863
+ // enabled for Microsoft Extensions or Borland Extensions, here.
1864
+ //
1865
+ // FIXME: __declspec is also currently enabled for CUDA, but isn't really a
1866
+ // CUDA extension. However, it is required for supporting
1867
+ // __clang_cuda_builtin_vars.h, which uses __declspec(property). Once that has
1868
+ // been rewritten in terms of something more generic, remove the Opts.CUDA
1869
+ // term here.
1870
+ defm declspec : BoolOption<"f", "declspec",
1871
+ LangOpts<"DeclSpecKeyword">, DefaultFalse,
1872
+ PosFlag<SetTrue, [], "Allow", [fms_extensions.KeyPath, fborland_extensions.KeyPath, cuda.KeyPath]>,
1873
+ NegFlag<SetFalse, [], "Disallow">,
1874
+ BothFlags<[CC1Option], " __declspec as a keyword">>, Group<f_clang_Group>;
1853
1875
def fmodules_cache_path : Joined<["-"], "fmodules-cache-path=">, Group<i_Group>,
1854
1876
Flags<[NoXarchOption, CC1Option]>, MetaVarName<"<directory>">,
1855
1877
HelpText<"Specify the module cache path">;
@@ -1976,7 +1998,6 @@ def fmudflapth : Flag<["-"], "fmudflapth">, Group<f_Group>;
1976
1998
def fmudflap : Flag<["-"], "fmudflap">, Group<f_Group>;
1977
1999
def fnested_functions : Flag<["-"], "fnested-functions">, Group<f_Group>;
1978
2000
def fnext_runtime : Flag<["-"], "fnext-runtime">, Group<f_Group>;
1979
- def fno_xl_pragma_pack : Flag<["-"], "fno-xl-pragma-pack">, Group<f_Group>;
1980
2001
def fno_asm : Flag<["-"], "fno-asm">, Group<f_Group>;
1981
2002
def fno_asynchronous_unwind_tables : Flag<["-"], "fno-asynchronous-unwind-tables">, Group<f_Group>;
1982
2003
def fno_assume_sane_operator_new : Flag<["-"], "fno-assume-sane-operator-new">, Group<f_Group>,
@@ -1997,8 +2018,6 @@ defm digraphs : BoolFOption<"digraphs",
1997
2018
PosFlag<SetTrue, [], "Enable alternative token representations '<:', ':>', '<%', '%>', '%:', '%:%:' (default)">,
1998
2019
NegFlag<SetFalse, [], "Disallow alternative token representations '<:', ':>', '<%', '%>', '%:', '%:%:'">,
1999
2020
BothFlags<[CC1Option]>>;
2000
- def fno_declspec : Flag<["-"], "fno-declspec">, Group<f_clang_Group>,
2001
- HelpText<"Disallow __declspec as a keyword">, Flags<[CC1Option]>;
2002
2021
def fno_eliminate_unused_debug_symbols : Flag<["-"], "fno-eliminate-unused-debug-symbols">, Group<f_Group>;
2003
2022
def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group<f_clang_Group>, Flags<[CC1Option]>;
2004
2023
def fno_inline : Flag<["-"], "fno-inline">, Group<f_clang_Group>, Flags<[CC1Option]>;
@@ -2084,10 +2103,10 @@ defm sized_deallocation : BoolFOption<"sized-deallocation",
2084
2103
LangOpts<"SizedDeallocation">, DefaultFalse,
2085
2104
PosFlag<SetTrue, [CC1Option], "Enable C++14 sized global deallocation functions">,
2086
2105
NegFlag<SetFalse>>;
2087
- def faligned_allocation : Flag<["-"], "faligned- allocation">, Flags<[CC1Option]> ,
2088
- HelpText<"Enable C++17 aligned allocation functions ">, Group<f_Group>;
2089
- def fno_aligned_allocation: Flag<["-" ], "fno- aligned- allocation">,
2090
- Group<f_Group >, Flags <[CC1Option]>;
2106
+ defm aligned_allocation : BoolFOption<"aligned- allocation",
2107
+ LangOpts<"AlignedAllocation ">, Default<cpp17.KeyPath>,
2108
+ PosFlag<SetTrue, [ ], "Enable C++17 aligned allocation functions ">,
2109
+ NegFlag<SetFalse >, BothFlags <[CC1Option]> >;
2091
2110
def fnew_alignment_EQ : Joined<["-"], "fnew-alignment=">,
2092
2111
HelpText<"Specifies the largest alignment guaranteed by '::operator new(size_t)'">,
2093
2112
MetaVarName<"<align>">, Group<f_Group>, Flags<[CC1Option]>,
@@ -2243,10 +2262,10 @@ defm short_enums : BoolFOption<"short-enums",
2243
2262
PosFlag<SetTrue, [CC1Option], "Allocate to an enum type only as many bytes as it"
2244
2263
" needs for the declared range of possible values">,
2245
2264
NegFlag<SetFalse>>;
2246
- def fchar8__t : Flag<["-"], "fchar8_t">, Group<f_Group>, Flags<[CC1Option]> ,
2247
- HelpText<"Enable C++ builtin type char8_t">;
2248
- def fno_char8__t : Flag<["-" ], "fno-char8_t ">, Group<f_Group>, Flags<[CC1Option] >,
2249
- HelpText<"Disable C++ builtin type char8_t">;
2265
+ defm char8__t : BoolFOption<"char8_t" ,
2266
+ LangOpts<"Char8">, Default<cpp20.KeyPath>,
2267
+ PosFlag<SetTrue, [ ], "Enable ">, NegFlag<SetFalse, [], "Disable" >,
2268
+ BothFlags<[CC1Option], " C++ builtin type char8_t"> >;
2250
2269
def fshort_wchar : Flag<["-"], "fshort-wchar">, Group<f_Group>,
2251
2270
HelpText<"Force wchar_t to be a short unsigned int">;
2252
2271
def fno_short_wchar : Flag<["-"], "fno-short-wchar">, Group<f_Group>,
@@ -2269,7 +2288,10 @@ defm spell_checking : BoolFOption<"spell-checking",
2269
2288
NegFlag<SetFalse, [CC1Option], "Disable spell-checking">, PosFlag<SetTrue>>;
2270
2289
def fspell_checking_limit_EQ : Joined<["-"], "fspell-checking-limit=">, Group<f_Group>;
2271
2290
def fsigned_bitfields : Flag<["-"], "fsigned-bitfields">, Group<f_Group>;
2272
- defm signed_char : OptOutFFlag<"signed-char", "char is signed", "char is unsigned">;
2291
+ defm signed_char : BoolFOption<"signed-char",
2292
+ LangOpts<"CharIsSigned">, DefaultTrue,
2293
+ NegFlag<SetFalse, [CC1Option], "char is unsigned">, PosFlag<SetTrue, [], "char is signed">>,
2294
+ ShouldParseIf<!strconcat("!", open_cl.KeyPath)>;
2273
2295
def fsplit_stack : Flag<["-"], "fsplit-stack">, Group<f_Group>;
2274
2296
def fstack_protector_all : Flag<["-"], "fstack-protector-all">, Group<f_Group>,
2275
2297
HelpText<"Enable stack protectors for all functions">;
@@ -2874,7 +2896,9 @@ def mno_stack_arg_probe : Flag<["-"], "mno-stack-arg-probe">, Group<m_Group>, Fl
2874
2896
HelpText<"Disable stack probes which are enabled by default">,
2875
2897
MarshallingInfoFlag<CodeGenOpts<"NoStackArgProbe">>;
2876
2898
def mthread_model : Separate<["-"], "mthread-model">, Group<m_Group>, Flags<[CC1Option]>,
2877
- HelpText<"The thread model to use, e.g. posix, single (posix by default)">, Values<"posix,single">;
2899
+ HelpText<"The thread model to use, e.g. posix, single (posix by default)">, Values<"posix,single">,
2900
+ NormalizedValues<["POSIX", "Single"]>, NormalizedValuesScope<"LangOptions::ThreadModelKind">,
2901
+ MarshallingInfoString<LangOpts<"ThreadModel">, "POSIX">, AutoNormalizeEnum;
2878
2902
def meabi : Separate<["-"], "meabi">, Group<m_Group>, Flags<[CC1Option]>,
2879
2903
HelpText<"Set EABI type, e.g. 4, 5 or gnu (default depends on triple)">, Values<"default,4,5,gnu">,
2880
2904
MarshallingInfoString<TargetOpts<"EABIVersion">, "Default">,
@@ -2995,7 +3019,9 @@ def msve_vector_bits_EQ : Joined<["-"], "msve-vector-bits=">,
2995
3019
Group<m_aarch64_Features_Group>, Flags<[NoXarchOption,CC1Option]>,
2996
3020
HelpText<"Specify the size in bits of an SVE vector register. Defaults to the"
2997
3021
" vector length agnostic value of \"scalable\". (AArch64 only)">,
2998
- Values<"128,256,512,1024,2048,scalable">;
3022
+ Values<"128,256,512,1024,2048,scalable">,
3023
+ NormalizedValues<["128", "256", "512", "1024", "2048", "0"]>,
3024
+ MarshallingInfoString<LangOpts<"ArmSveVectorBits">, "0">, AutoNormalizeEnum;
2999
3025
3000
3026
def msign_return_address_EQ : Joined<["-"], "msign-return-address=">,
3001
3027
Flags<[CC1Option]>, Group<m_Group>, Values<"none,all,non-leaf">,
@@ -3064,7 +3090,8 @@ def mspe : Flag<["-"], "mspe">, Group<m_ppc_Features_Group>;
3064
3090
def mno_spe : Flag<["-"], "mno-spe">, Group<m_ppc_Features_Group>;
3065
3091
def mefpu2 : Flag<["-"], "mefpu2">, Group<m_ppc_Features_Group>;
3066
3092
def mabi_EQ_vec_extabi : Flag<["-"], "mabi=vec-extabi">, Group<m_Group>, Flags<[CC1Option]>,
3067
- HelpText<"Enable the extended Altivec ABI on AIX (AIX only). Uses volatile and nonvolatile vector registers">;
3093
+ HelpText<"Enable the extended Altivec ABI on AIX (AIX only). Uses volatile and nonvolatile vector registers">,
3094
+ MarshallingInfoFlag<LangOpts<"EnableAIXExtendedAltivecABI">>;
3068
3095
def mabi_EQ_vec_default : Flag<["-"], "mabi=vec-default">, Group<m_Group>, Flags<[CC1Option]>,
3069
3096
HelpText<"Enable the default Altivec ABI on AIX (AIX only). Uses only volatile vector registers.">;
3070
3097
def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>;
@@ -5007,11 +5034,13 @@ def print_stats : Flag<["-"], "print-stats">,
5007
5034
def stats_file : Joined<["-"], "stats-file=">,
5008
5035
HelpText<"Filename to write statistics to">,
5009
5036
MarshallingInfoString<FrontendOpts<"StatsFile">>;
5010
- def fdump_record_layouts : Flag<["-"], "fdump-record-layouts">,
5011
- HelpText<"Dump record layout information">;
5012
5037
def fdump_record_layouts_simple : Flag<["-"], "fdump-record-layouts-simple">,
5013
5038
HelpText<"Dump record layout information in a simple form used for testing">,
5014
5039
MarshallingInfoFlag<LangOpts<"DumpRecordLayoutsSimple">>;
5040
+ def fdump_record_layouts : Flag<["-"], "fdump-record-layouts">,
5041
+ HelpText<"Dump record layout information">,
5042
+ MarshallingInfoFlag<LangOpts<"DumpRecordLayouts">>,
5043
+ ImpliedByAnyOf<[fdump_record_layouts_simple.KeyPath]>;
5015
5044
def fix_what_you_can : Flag<["-"], "fix-what-you-can">,
5016
5045
HelpText<"Apply fix-it advice even in the presence of unfixable errors">,
5017
5046
MarshallingInfoFlag<FrontendOpts<"FixWhatYouCan">>;
@@ -5045,7 +5074,9 @@ def building_pch_with_obj : Flag<["-"], "building-pch-with-obj">,
5045
5074
MarshallingInfoFlag<LangOpts<"BuildingPCHWithObjectFile">>;
5046
5075
5047
5076
def aligned_alloc_unavailable : Flag<["-"], "faligned-alloc-unavailable">,
5048
- HelpText<"Aligned allocation/deallocation functions are unavailable">;
5077
+ HelpText<"Aligned allocation/deallocation functions are unavailable">,
5078
+ MarshallingInfoFlag<LangOpts<"AlignedAllocationUnavailable">>,
5079
+ ShouldParseIf<faligned_allocation.KeyPath>;
5049
5080
5050
5081
//===----------------------------------------------------------------------===//
5051
5082
// Language Options
@@ -5075,7 +5106,9 @@ def split_dwarf_file : Separate<["-"], "split-dwarf-file">,
5075
5106
HelpText<"Name of the split dwarf debug info file to encode in the object file">,
5076
5107
MarshallingInfoString<CodeGenOpts<"SplitDwarfFile">>;
5077
5108
def fno_wchar : Flag<["-"], "fno-wchar">,
5078
- HelpText<"Disable C++ builtin type wchar_t">;
5109
+ HelpText<"Disable C++ builtin type wchar_t">,
5110
+ MarshallingInfoNegativeFlag<LangOpts<"WChar">, cplusplus.KeyPath>,
5111
+ ShouldParseIf<cplusplus.KeyPath>;
5079
5112
def fconstant_string_class : Separate<["-"], "fconstant-string-class">,
5080
5113
MetaVarName<"<class name>">,
5081
5114
HelpText<"Specify the class to use for constant Objective-C string objects.">,
@@ -5100,7 +5133,8 @@ def function_alignment : Separate<["-"], "function-alignment">,
5100
5133
HelpText<"default alignment for functions">,
5101
5134
MarshallingInfoStringInt<LangOpts<"FunctionAlignment">>;
5102
5135
def pic_level : Separate<["-"], "pic-level">,
5103
- HelpText<"Value for __PIC__">;
5136
+ HelpText<"Value for __PIC__">,
5137
+ MarshallingInfoStringInt<LangOpts<"PICLevel">>;
5104
5138
def pic_is_pie : Flag<["-"], "pic-is-pie">,
5105
5139
HelpText<"File is for a position independent executable">,
5106
5140
MarshallingInfoFlag<LangOpts<"PIE">>;
@@ -5187,10 +5221,10 @@ def fdebugger_cast_result_to_id : Flag<["-"], "fdebugger-cast-result-to-id">,
5187
5221
def fdebugger_objc_literal : Flag<["-"], "fdebugger-objc-literal">,
5188
5222
HelpText<"Enable special debugger support for Objective-C subscripting and literals">,
5189
5223
MarshallingInfoFlag<LangOpts<"DebuggerObjCLiteral">>;
5190
- def fdeprecated_macro : Flag<["-"] , "fdeprecated -macro"> ,
5191
- HelpText<"Defines the __DEPRECATED macro">;
5192
- def fno_deprecated_macro : Flag<["-" ], "fno-deprecated-macro ">,
5193
- HelpText<"Undefines the __DEPRECATED macro">;
5224
+ defm deprecated_macro : BoolOption<"f" , "deprecated -macro",
5225
+ LangOpts<"Deprecated">, DefaultFalse,
5226
+ PosFlag<SetTrue, [], "Defines">, NegFlag<SetFalse, [ ], "Undefines ">,
5227
+ BothFlags<[], " the __DEPRECATED macro"> >;
5194
5228
def fobjc_subscripting_legacy_runtime : Flag<["-"], "fobjc-subscripting-legacy-runtime">,
5195
5229
HelpText<"Allow Objective-C array and dictionary subscripting in legacy runtime">;
5196
5230
// TODO: Enforce values valid for MSVtorDispMode.
0 commit comments