diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -66,6 +66,26 @@ // GCC compatibility. class IgnoredGCCCompat : Flags<[HelpHidden]> {} +// A boolean option which is opt-in in CC1. The positive option exists in CC1 and +// Args.hasArg(OPT_ffoo) is used to check that the flag is enabled. +// This is useful if the option is usually disabled. +multiclass OptInFFlag flags=[]> { + def f#NAME : Flag<["-"], "f"#name>, Flags, + HelpText; + def fno_#NAME : Flag<["-"], "fno-"#name>, Flags, + HelpText; +} + +// A boolean option which is opt-out in CC1. The negative option exists in CC1 and +// Args.hasArg(OPT_fno_foo) is used to check that the flag is disabled. +multiclass OptOutFFlag flags=[]> { + def f#NAME : Flag<["-"], "f"#name>, Flags, HelpText; + def fno_ #NAME : Flag<["-"], "fno-"#name>, Flags, + HelpText; +} + ///////// // Groups @@ -824,10 +844,7 @@ Group, Flags<[CC1Option, CoreOption]>, HelpText<"Generate instrumented code to collect order file into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)">; -def faddrsig : Flag<["-"], "faddrsig">, Group, Flags<[CoreOption, CC1Option]>, - HelpText<"Emit an address-significance table">; -def fno_addrsig : Flag<["-"], "fno-addrsig">, Group, Flags<[CoreOption]>, - HelpText<"Don't emit an address-significance table">; +defm addrsig : OptInFFlag<"addrsig", "Emit", "Don't emit", " an address-significance table", [CoreOption]>; def fblocks : Flag<["-"], "fblocks">, Group, Flags<[CoreOption, CC1Option]>, HelpText<"Enable the 'blocks' language feature">; def fbootclasspath_EQ : Joined<["-"], "fbootclasspath=">, Group; @@ -969,15 +986,8 @@ def fbracket_depth_EQ : Joined<["-"], "fbracket-depth=">, Group, Flags<[CoreOption]>; def fsignaling_math : Flag<["-"], "fsignaling-math">, Group; def fno_signaling_math : Flag<["-"], "fno-signaling-math">, Group; -def fjump_tables : Flag<["-"], "fjump-tables">, Group; -def fno_jump_tables : Flag<["-"], "fno-jump-tables">, Group, Flags<[CC1Option]>, - HelpText<"Do not use jump tables for lowering switches">; -def fforce_enable_int128 : Flag<["-"], "fforce-enable-int128">, - Group, Flags<[CC1Option]>, - HelpText<"Enable support for int128_t type">; -def fno_force_enable_int128 : Flag<["-"], "fno-force-enable-int128">, - Group, Flags<[CC1Option]>, - HelpText<"Disable support for int128_t type">; +defm jump_tables : OptOutFFlag<"jump-tables", "Use", "Do not use", " jump tables for lowering switches">; +defm force_enable_int128 : OptInFFlag<"force-enable-int128", "Enable", "Disable", " support for int128_t type">; def fkeep_static_consts : Flag<["-"], "fkeep-static-consts">, Group, Flags<[CC1Option]>, HelpText<"Keep static const variables even if unused">; def ffixed_point : Flag<["-"], "ffixed-point">, Group,