jansvoboda11 updated this revision to Diff 311216. jansvoboda11 added a comment.
Rebase Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93094/new/ https://reviews.llvm.org/D93094 Files: clang/include/clang/Driver/Options.td clang/lib/Frontend/CompilerInvocation.cpp clang/unittests/Frontend/CompilerInvocationTest.cpp llvm/include/llvm/Option/OptParser.td Index: llvm/include/llvm/Option/OptParser.td =================================================================== --- llvm/include/llvm/Option/OptParser.td +++ llvm/include/llvm/Option/OptParser.td @@ -173,10 +173,10 @@ // Marshalling info for booleans. Applied to the flag setting keypath to false. class MarshallingInfoBooleanFlag<code keypath, code defaultvalue, code value, code name, - code other_value, code other_name, string other_spelling> + code other_value, code other_name> : MarshallingInfoFlag<keypath, defaultvalue> { code Normalizer = "makeBooleanOptionNormalizer("#value#", "#other_value#", OPT_"#other_name#")"; - code Denormalizer = "makeBooleanOptionDenormalizer("#value#", \""#other_spelling#"\")"; + code Denormalizer = "makeBooleanOptionDenormalizer("#value#")"; } // Mixins for additional marshalling attributes. Index: clang/unittests/Frontend/CompilerInvocationTest.cpp =================================================================== --- clang/unittests/Frontend/CompilerInvocationTest.cpp +++ clang/unittests/Frontend/CompilerInvocationTest.cpp @@ -269,7 +269,7 @@ Invocation.generateCC1CommandLine(GeneratedArgs, *this); - ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fdebug-pass-manager"))); + ASSERT_EQ(count(GeneratedArgs, "-fdebug-pass-manager"), 1); ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fno-debug-pass-manager")))); } Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -197,12 +197,11 @@ }; } -static auto makeBooleanOptionDenormalizer(bool Value, - const char *OtherSpelling) { - return [Value, OtherSpelling]( - SmallVectorImpl<const char *> &Args, const char *Spelling, - CompilerInvocation::StringAllocator, unsigned, bool KeyPath) { - Args.push_back(KeyPath == Value ? Spelling : OtherSpelling); +static auto makeBooleanOptionDenormalizer(bool Value) { + return [Value](SmallVectorImpl<const char *> &Args, const char *Spelling, + CompilerInvocation::StringAllocator, unsigned, bool KeyPath) { + if (KeyPath == Value) + Args.push_back(Spelling); }; } Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -338,7 +338,7 @@ : Flag<["-"], flag.Spelling>, Flags<flag.OptionFlags>, HelpText<flag.Help>, MarshallingInfoBooleanFlag<keypath, default.Value, flag.ValueAsCode, flag.RecordName, other.ValueAsCode, - other.RecordName, other.Spelling>, + other.RecordName>, ImpliedByAnyOf<implied.ImpliedBy, implied.ValueAsCode> {} // Generates TableGen records for two command line flags that control the same
Index: llvm/include/llvm/Option/OptParser.td =================================================================== --- llvm/include/llvm/Option/OptParser.td +++ llvm/include/llvm/Option/OptParser.td @@ -173,10 +173,10 @@ // Marshalling info for booleans. Applied to the flag setting keypath to false. class MarshallingInfoBooleanFlag<code keypath, code defaultvalue, code value, code name, - code other_value, code other_name, string other_spelling> + code other_value, code other_name> : MarshallingInfoFlag<keypath, defaultvalue> { code Normalizer = "makeBooleanOptionNormalizer("#value#", "#other_value#", OPT_"#other_name#")"; - code Denormalizer = "makeBooleanOptionDenormalizer("#value#", \""#other_spelling#"\")"; + code Denormalizer = "makeBooleanOptionDenormalizer("#value#")"; } // Mixins for additional marshalling attributes. Index: clang/unittests/Frontend/CompilerInvocationTest.cpp =================================================================== --- clang/unittests/Frontend/CompilerInvocationTest.cpp +++ clang/unittests/Frontend/CompilerInvocationTest.cpp @@ -269,7 +269,7 @@ Invocation.generateCC1CommandLine(GeneratedArgs, *this); - ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fdebug-pass-manager"))); + ASSERT_EQ(count(GeneratedArgs, "-fdebug-pass-manager"), 1); ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fno-debug-pass-manager")))); } Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -197,12 +197,11 @@ }; } -static auto makeBooleanOptionDenormalizer(bool Value, - const char *OtherSpelling) { - return [Value, OtherSpelling]( - SmallVectorImpl<const char *> &Args, const char *Spelling, - CompilerInvocation::StringAllocator, unsigned, bool KeyPath) { - Args.push_back(KeyPath == Value ? Spelling : OtherSpelling); +static auto makeBooleanOptionDenormalizer(bool Value) { + return [Value](SmallVectorImpl<const char *> &Args, const char *Spelling, + CompilerInvocation::StringAllocator, unsigned, bool KeyPath) { + if (KeyPath == Value) + Args.push_back(Spelling); }; } Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -338,7 +338,7 @@ : Flag<["-"], flag.Spelling>, Flags<flag.OptionFlags>, HelpText<flag.Help>, MarshallingInfoBooleanFlag<keypath, default.Value, flag.ValueAsCode, flag.RecordName, other.ValueAsCode, - other.RecordName, other.Spelling>, + other.RecordName>, ImpliedByAnyOf<implied.ImpliedBy, implied.ValueAsCode> {} // Generates TableGen records for two command line flags that control the same
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits