@@ -435,12 +435,17 @@ class MarshallingInfoVisibility<KeyPathAndMacro kpm, code default>
435
435
436
436
// Key paths that are constant during parsing of options with the same key path prefix.
437
437
defvar cplusplus = LangOpts<"CPlusPlus">;
438
+ defvar cpp11 = LangOpts<"CPlusPlus11">;
439
+ defvar cpp20 = LangOpts<"CPlusPlus20">;
438
440
defvar c99 = LangOpts<"C99">;
441
+ defvar c2x = LangOpts<"C2x">;
439
442
defvar lang_std = LangOpts<"LangStd">;
440
443
defvar open_cl = LangOpts<"OpenCL">;
441
444
defvar render_script = LangOpts<"RenderScript">;
442
445
defvar hip = LangOpts<"HIP">;
443
446
defvar gnu_mode = LangOpts<"GNUMode">;
447
+ defvar asm_preprocessor = LangOpts<"AsmPreprocessor">;
448
+ defvar cpp_modules = LangOpts<"CPlusPlusModules">;
444
449
445
450
defvar std = !strconcat("LangStandard::getLangStandardForKind(", lang_std.KeyPath, ")");
446
451
@@ -997,28 +1002,27 @@ def static_libsan : Flag<["-"], "static-libsan">,
997
1002
def : Flag<["-"], "shared-libasan">, Alias<shared_libsan>;
998
1003
def fasm : Flag<["-"], "fasm">, Group<f_Group>;
999
1004
1000
- defm asm_blocks : OptInFFlag<"asm-blocks", "">;
1001
-
1002
1005
def fassume_sane_operator_new : Flag<["-"], "fassume-sane-operator-new">, Group<f_Group>;
1003
1006
def fastcp : Flag<["-"], "fastcp">, Group<f_Group>;
1004
1007
def fastf : Flag<["-"], "fastf">, Group<f_Group>;
1005
1008
def fast : Flag<["-"], "fast">, Group<f_Group>;
1006
1009
def fasynchronous_unwind_tables : Flag<["-"], "fasynchronous-unwind-tables">, Group<f_Group>;
1007
1010
1008
- def fdouble_square_bracket_attributes : Flag<[ "-" ], "fdouble-square-bracket-attributes">,
1009
- Group<f_Group>, Flags<[NoXarchOption, CC1Option]>,
1010
- HelpText<"Enable '[[]]' attributes in all C and C++ language modes">;
1011
- def fno_double_square_bracket_attributes : Flag<[ "-" ], "fno-double-square-bracket-attributes">,
1012
- Group<f_Group>, Flags<[NoXarchOption, CC1Option]>,
1013
- HelpText<"Disable '[[]]' attributes in all C and C++ language modes">;
1011
+ defm double_square_bracket_attributes : BoolFOption<"double-square-bracket-attributes",
1012
+ LangOpts<"DoubleSquareBracketAttributes">, Default<!strconcat(cpp11.KeyPath, "||", c2x.KeyPath)>,
1013
+ PosFlag<SetTrue, [], "Enable">, NegFlag<SetFalse, [], "Disable">,
1014
+ BothFlags<[NoXarchOption, CC1Option], " '[[]]' attributes in all C and C++ language modes">>;
1014
1015
1015
1016
defm autolink : BoolFOption<"autolink",
1016
1017
CodeGenOpts<"Autolink">, DefaultTrue,
1017
1018
NegFlag<SetFalse, [CC1Option], "Disable generation of linker directives for automatic library linking">,
1018
1019
PosFlag<SetTrue>>;
1019
1020
1020
1021
// C++ Coroutines TS
1021
- defm coroutines_ts : OptInFFlag<"coroutines-ts", "Enable support for the C++ Coroutines TS">;
1022
+ defm coroutines_ts : BoolFOption<"coroutines-ts",
1023
+ LangOpts<"Coroutines">, Default<cpp20.KeyPath>,
1024
+ PosFlag<SetTrue, [CC1Option], "Enable support for the C++ Coroutines TS">,
1025
+ NegFlag<SetFalse>>;
1022
1026
1023
1027
def fembed_bitcode_EQ : Joined<["-"], "fembed-bitcode=">,
1024
1028
Group<f_Group>, Flags<[NoXarchOption, CC1Option, CC1AsOption]>, MetaVarName<"<option>">,
@@ -1273,8 +1277,10 @@ def fdiscard_value_names : Flag<["-"], "fdiscard-value-names">, Group<f_clang_Gr
1273
1277
HelpText<"Discard value names in LLVM IR">, Flags<[NoXarchOption]>;
1274
1278
def fno_discard_value_names : Flag<["-"], "fno-discard-value-names">, Group<f_clang_Group>,
1275
1279
HelpText<"Do not discard value names in LLVM IR">, Flags<[NoXarchOption]>;
1276
- def fdollars_in_identifiers : Flag<["-"], "fdollars-in-identifiers">, Group<f_Group>,
1277
- HelpText<"Allow '$' in identifiers">, Flags<[CC1Option]>;
1280
+ defm dollars_in_identifiers : BoolFOption<"dollars-in-identifiers",
1281
+ LangOpts<"DollarIdents">, Default<!strconcat("!", asm_preprocessor.KeyPath)>,
1282
+ PosFlag<SetTrue, [], "Allow">, NegFlag<SetFalse, [], "Disallow">,
1283
+ BothFlags<[CC1Option], " '$' in identifiers">>;
1278
1284
def fdwarf2_cfi_asm : Flag<["-"], "fdwarf2-cfi-asm">, Group<clang_ignored_f_Group>;
1279
1285
def fno_dwarf2_cfi_asm : Flag<["-"], "fno-dwarf2-cfi-asm">, Group<clang_ignored_f_Group>;
1280
1286
defm dwarf_directory_asm : BoolFOption<"dwarf-directory-asm",
@@ -1358,7 +1364,10 @@ defm keep_static_consts : BoolFOption<"keep-static-consts",
1358
1364
CodeGenOpts<"KeepStaticConsts">, DefaultFalse,
1359
1365
PosFlag<SetTrue, [CC1Option], "Keep">, NegFlag<SetFalse, [], "Don't keep">,
1360
1366
BothFlags<[NoXarchOption], " static const variables if unused">>;
1361
- defm fixed_point : OptInFFlag<"fixed-point", "Enable", "Disable", " fixed point types">;
1367
+ defm fixed_point : BoolFOption<"fixed-point",
1368
+ LangOpts<"FixedPoint">, DefaultFalse,
1369
+ PosFlag<SetTrue, [CC1Option], "Enable">, NegFlag<SetFalse, [], "Disable">,
1370
+ BothFlags<[], " fixed point types">>, ShouldParseIf<!strconcat("!", cplusplus.KeyPath)>;
1362
1371
defm cxx_static_destructors : BoolFOption<"c++-static-destructors",
1363
1372
LangOpts<"RegisterStaticDestructors">, DefaultTrue,
1364
1373
NegFlag<SetFalse, [CC1Option], "Disable C++ static destructor registration">,
@@ -1810,11 +1819,15 @@ defm merge_all_constants : BoolFOption<"merge-all-constants",
1810
1819
def fmessage_length_EQ : Joined<["-"], "fmessage-length=">, Group<f_Group>, Flags<[CC1Option]>,
1811
1820
HelpText<"Format message diagnostics so that they fit within N columns">,
1812
1821
MarshallingInfoStringInt<DiagnosticOpts<"MessageLength">>;
1813
- def fms_extensions : Flag<["-"], "fms-extensions">, Group<f_Group>, Flags<[CC1Option, CoreOption]>,
1814
- HelpText<"Accept some non-standard constructs supported by the Microsoft compiler">;
1815
1822
def fms_compatibility : Flag<["-"], "fms-compatibility">, Group<f_Group>, Flags<[CC1Option, CoreOption]>,
1816
1823
HelpText<"Enable full Microsoft Visual C++ compatibility">,
1817
1824
MarshallingInfoFlag<LangOpts<"MSVCCompat">>;
1825
+ def fms_extensions : Flag<["-"], "fms-extensions">, Group<f_Group>, Flags<[CC1Option, CoreOption]>,
1826
+ HelpText<"Accept some non-standard constructs supported by the Microsoft compiler">,
1827
+ MarshallingInfoFlag<LangOpts<"MicrosoftExt">>, ImpliedByAnyOf<[fms_compatibility.KeyPath]>;
1828
+ defm asm_blocks : BoolFOption<"asm-blocks",
1829
+ LangOpts<"AsmBlocks">, Default<fms_extensions.KeyPath>,
1830
+ PosFlag<SetTrue, [CC1Option]>, NegFlag<SetFalse>>;
1818
1831
def fms_volatile : Flag<["-"], "fms-volatile">, Group<f_Group>, Flags<[CC1Option]>,
1819
1832
MarshallingInfoFlag<CodeGenOpts<"MSVolatile">>;
1820
1833
def fmsc_version : Joined<["-"], "fmsc-version=">, Group<f_Group>, Flags<[NoXarchOption, CoreOption]>,
@@ -1858,9 +1871,6 @@ def fmodules_prune_after : Joined<["-"], "fmodules-prune-after=">, Group<i_Group
1858
1871
Flags<[CC1Option]>, MetaVarName<"<seconds>">,
1859
1872
HelpText<"Specify the interval (in seconds) after which a module file will be considered unused">,
1860
1873
MarshallingInfoStringInt<HeaderSearchOpts<"ModuleCachePruneAfter">, "31 * 24 * 60 * 60">;
1861
- def fmodules_search_all : Flag <["-"], "fmodules-search-all">, Group<f_Group>,
1862
- Flags<[NoXarchOption, CC1Option]>,
1863
- HelpText<"Search even non-imported modules to resolve references">;
1864
1874
def fbuild_session_timestamp : Joined<["-"], "fbuild-session-timestamp=">,
1865
1875
Group<i_Group>, Flags<[CC1Option]>, MetaVarName<"<time since Epoch in seconds>">,
1866
1876
HelpText<"Time when the current build session started">,
@@ -1912,16 +1922,17 @@ defm pch_codegen: OptInFFlag<"pch-codegen", "Generate ", "Do not generate ",
1912
1922
defm pch_debuginfo: OptInFFlag<"pch-debuginfo", "Generate ", "Do not generate ",
1913
1923
"debug info for types in an object file built from this PCH and do not generate them elsewhere">;
1914
1924
1915
- def fmodules : Flag <["-"], "fmodules">, Group<f_Group>,
1916
- Flags<[NoXarchOption, CC1Option]>,
1917
- HelpText<"Enable the 'modules' language feature">;
1918
1925
def fimplicit_module_maps : Flag <["-"], "fimplicit-module-maps">, Group<f_Group>,
1919
1926
Flags<[NoXarchOption, CC1Option]>,
1920
1927
HelpText<"Implicitly search the file system for module map files.">,
1921
1928
MarshallingInfoFlag<HeaderSearchOpts<"ImplicitModuleMaps">>;
1922
1929
def fmodules_ts : Flag <["-"], "fmodules-ts">, Group<f_Group>,
1923
1930
Flags<[CC1Option]>, HelpText<"Enable support for the C++ Modules TS">,
1924
1931
MarshallingInfoFlag<LangOpts<"ModulesTS">>;
1932
+ defm modules : BoolFOption<"modules",
1933
+ LangOpts<"Modules">, Default<!strconcat(fmodules_ts.KeyPath, "||", cpp_modules.KeyPath)>,
1934
+ PosFlag<SetTrue, [CC1Option], "Enable the 'modules' language feature">,
1935
+ NegFlag<SetFalse>, BothFlags<[NoXarchOption]>>;
1925
1936
def fmodule_maps : Flag <["-"], "fmodule-maps">, Alias<fimplicit_module_maps>;
1926
1937
def fmodule_name_EQ : Joined<["-"], "fmodule-name=">, Group<f_Group>,
1927
1938
Flags<[NoXarchOption,CC1Option]>, MetaVarName<"<name>">,
@@ -1942,15 +1953,19 @@ def fmodule_file : Joined<["-"], "fmodule-file=">,
1942
1953
HelpText<"Specify the mapping of module name to precompiled module file, or load a module file if name is omitted.">;
1943
1954
def fmodules_ignore_macro : Joined<["-"], "fmodules-ignore-macro=">, Group<f_Group>, Flags<[CC1Option]>,
1944
1955
HelpText<"Ignore the definition of the given macro when building and loading modules">;
1945
- def fmodules_decluse : Flag <["-"], "fmodules-decluse">, Group<f_Group>,
1946
- Flags<[NoXarchOption,CC1Option]>,
1947
- HelpText<"Require declaration of modules used within a module">;
1948
1956
def fmodules_strict_decluse : Flag <["-"], "fmodules-strict-decluse">, Group<f_Group>,
1949
1957
Flags<[NoXarchOption,CC1Option]>,
1950
1958
HelpText<"Like -fmodules-decluse but requires all headers to be in modules">,
1951
1959
MarshallingInfoFlag<LangOpts<"ModulesStrictDeclUse">>;
1952
- def fno_modules_search_all : Flag <["-"], "fno-modules-search-all">, Group<f_Group>,
1953
- Flags<[NoXarchOption, CC1Option]>;
1960
+ defm modules_decluse : BoolFOption<"modules-decluse",
1961
+ LangOpts<"ModulesDeclUse">, Default<fmodules_strict_decluse.KeyPath>,
1962
+ PosFlag<SetTrue, [CC1Option], "Require declaration of modules used within a module">,
1963
+ NegFlag<SetFalse>, BothFlags<[NoXarchOption]>>;
1964
+ defm modules_search_all : BoolFOption<"modules-search-all",
1965
+ LangOpts<"ModulesSearchAll">, DefaultFalse,
1966
+ PosFlag<SetTrue, [], "Search even non-imported modules to resolve references">,
1967
+ NegFlag<SetFalse>, BothFlags<[NoXarchOption, CC1Option]>>,
1968
+ ShouldParseIf<fmodules.KeyPath>;
1954
1969
defm implicit_modules : BoolFOption<"implicit-modules",
1955
1970
LangOpts<"ImplicitModules">, DefaultTrue,
1956
1971
NegFlag<SetFalse, [CC1Option]>, PosFlag<SetTrue>, BothFlags<[NoXarchOption]>>;
@@ -1984,8 +1999,6 @@ defm digraphs : BoolFOption<"digraphs",
1984
1999
BothFlags<[CC1Option]>>;
1985
2000
def fno_declspec : Flag<["-"], "fno-declspec">, Group<f_clang_Group>,
1986
2001
HelpText<"Disallow __declspec as a keyword">, Flags<[CC1Option]>;
1987
- def fno_dollars_in_identifiers : Flag<["-"], "fno-dollars-in-identifiers">, Group<f_Group>,
1988
- HelpText<"Disallow '$' in identifiers">, Flags<[CC1Option]>;
1989
2002
def fno_eliminate_unused_debug_symbols : Flag<["-"], "fno-eliminate-unused-debug-symbols">, Group<f_Group>;
1990
2003
def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group<f_clang_Group>, Flags<[CC1Option]>;
1991
2004
def fno_inline : Flag<["-"], "fno-inline">, Group<f_clang_Group>, Flags<[CC1Option]>;
@@ -2001,13 +2014,9 @@ def fveclib : Joined<["-"], "fveclib=">, Group<f_Group>, Flags<[CC1Option]>,
2001
2014
MarshallingInfoString<CodeGenOpts<"VecLib">, "NoLibrary">, AutoNormalizeEnum;
2002
2015
def fno_lax_vector_conversions : Flag<["-"], "fno-lax-vector-conversions">, Group<f_Group>,
2003
2016
Alias<flax_vector_conversions_EQ>, AliasArgs<["none"]>;
2004
- def fno_modules : Flag <["-"], "fno-modules">, Group<f_Group>,
2005
- Flags<[NoXarchOption]>;
2006
2017
def fno_implicit_module_maps : Flag <["-"], "fno-implicit-module-maps">, Group<f_Group>,
2007
2018
Flags<[NoXarchOption]>;
2008
2019
def fno_module_maps : Flag <["-"], "fno-module-maps">, Alias<fno_implicit_module_maps>;
2009
- def fno_modules_decluse : Flag <["-"], "fno-modules-decluse">, Group<f_Group>,
2010
- Flags<[NoXarchOption]>;
2011
2020
def fno_modules_strict_decluse : Flag <["-"], "fno-strict-modules-decluse">, Group<f_Group>,
2012
2021
Flags<[NoXarchOption]>;
2013
2022
def fmodule_file_deps : Flag <["-"], "fmodule-file-deps">, Group<f_Group>,
@@ -2023,7 +2032,7 @@ def fno_objc_weak : Flag<["-"], "fno-objc-weak">, Group<f_Group>, Flags<[CC1Opti
2023
2032
def fno_omit_frame_pointer : Flag<["-"], "fno-omit-frame-pointer">, Group<f_Group>;
2024
2033
def fno_operator_names : Flag<["-"], "fno-operator-names">, Group<f_Group>,
2025
2034
HelpText<"Do not treat C++ operator name keywords as synonyms for operators">,
2026
- Flags<[CC1Option]>;
2035
+ Flags<[CC1Option]>, MarshallingInfoNegativeFlag<LangOpts<"CXXOperatorNames">, cplusplus.KeyPath> ;
2027
2036
def fdiagnostics_absolute_paths : Flag<["-"], "fdiagnostics-absolute-paths">, Group<f_Group>,
2028
2037
Flags<[CC1Option, CoreOption]>, HelpText<"Print absolute paths in diagnostics">,
2029
2038
MarshallingInfoFlag<DiagnosticOpts<"AbsolutePath">>;
@@ -2220,8 +2229,14 @@ def framework : Separate<["-"], "framework">, Flags<[LinkerInput]>;
2220
2229
def frandom_seed_EQ : Joined<["-"], "frandom-seed=">, Group<clang_ignored_f_Group>;
2221
2230
def freg_struct_return : Flag<["-"], "freg-struct-return">, Group<f_Group>, Flags<[CC1Option]>,
2222
2231
HelpText<"Override the default ABI to return small structs in registers">;
2223
- defm rtti : OptOutFFlag<"rtti", "", "Disable generation of rtti information">;
2224
- defm rtti_data : OptOutFFlag<"rtti-data", "", "Disable generation of RTTI data">;
2232
+ defm rtti : BoolFOption<"rtti",
2233
+ LangOpts<"RTTI">, Default<cplusplus.KeyPath>,
2234
+ NegFlag<SetFalse, [CC1Option], "Disable generation of rtti information">,
2235
+ PosFlag<SetTrue>>, ShouldParseIf<cplusplus.KeyPath>;
2236
+ defm rtti_data : BoolFOption<"rtti-data",
2237
+ LangOpts<"RTTIData">, Default<frtti.KeyPath>,
2238
+ NegFlag<SetFalse, [CC1Option], "Disable generation of RTTI data">,
2239
+ PosFlag<SetTrue>>, ShouldParseIf<frtti.KeyPath>;
2225
2240
def : Flag<["-"], "fsched-interblock">, Group<clang_ignored_f_Group>;
2226
2241
defm short_enums : BoolFOption<"short-enums",
2227
2242
LangOpts<"ShortEnums">, DefaultFalse,
@@ -4201,9 +4216,11 @@ def mfpmath : Separate<["-"], "mfpmath">,
4201
4216
HelpText<"Which unit to use for fp math">,
4202
4217
MarshallingInfoString<TargetOpts<"FPMath">>;
4203
4218
4204
- def fpadding_on_unsigned_fixed_point : Flag<["-"], "fpadding-on-unsigned-fixed-point">,
4205
- HelpText<"Force each unsigned fixed point type to have an extra bit of padding to align their scales with those of signed fixed point types">;
4206
- def fno_padding_on_unsigned_fixed_point : Flag<["-"], "fno-padding-on-unsigned-fixed-point">;
4219
+ defm padding_on_unsigned_fixed_point : BoolOption<"f", "padding-on-unsigned-fixed-point",
4220
+ LangOpts<"PaddingOnUnsignedFixedPoint">, DefaultFalse,
4221
+ PosFlag<SetTrue, [], "Force each unsigned fixed point type to have an extra bit of padding to align their scales with those of signed fixed point types">,
4222
+ NegFlag<SetFalse>>,
4223
+ ShouldParseIf<ffixed_point.KeyPath>;
4207
4224
4208
4225
//===----------------------------------------------------------------------===//
4209
4226
// Analyzer Options
@@ -4845,10 +4862,14 @@ def fmodules_embed_all_files : Joined<["-"], "fmodules-embed-all-files">,
4845
4862
HelpText<"Embed the contents of all files read by this compilation into "
4846
4863
"the produced module file.">,
4847
4864
MarshallingInfoFlag<FrontendOpts<"ModulesEmbedAllFiles">>;
4865
+ // FIXME: We only need this in C++ modules / Modules TS if we might textually
4866
+ // enter a different module (eg, when building a header unit).
4848
4867
def fmodules_local_submodule_visibility :
4849
4868
Flag<["-"], "fmodules-local-submodule-visibility">,
4850
4869
HelpText<"Enforce name visibility rules across submodules of the same "
4851
- "top-level module.">;
4870
+ "top-level module.">,
4871
+ MarshallingInfoFlag<LangOpts<"ModulesLocalVisibility">>,
4872
+ ImpliedByAnyOf<[fmodules_ts.KeyPath, cpp_modules.KeyPath]>;
4852
4873
def fmodules_codegen :
4853
4874
Flag<["-"], "fmodules-codegen">,
4854
4875
HelpText<"Generate code for uses of this module that assumes an explicit "
0 commit comments