diff options
-rw-r--r-- | clang/include/clang/Driver/Options.td | 2 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 11 | ||||
-rw-r--r-- | clang/unittests/Frontend/CompilerInvocationTest.cpp | 2 | ||||
-rw-r--r-- | llvm/include/llvm/Option/OptParser.td | 4 |
4 files changed, 9 insertions, 10 deletions
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 0da6a43..a2208f2 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -338,7 +338,7 @@ class BoolOptionFlag<FlagDefExpanded flag, FlagDefExpanded other, : 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 diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 1a863a7..bdadaa9 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -197,12 +197,11 @@ static auto makeBooleanOptionNormalizer(bool Value, bool OtherValue, }; } -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); }; } diff --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp b/clang/unittests/Frontend/CompilerInvocationTest.cpp index 156e3393..51b7ba8 100644 --- a/clang/unittests/Frontend/CompilerInvocationTest.cpp +++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp @@ -269,7 +269,7 @@ TEST_F(CommandLineTest, BoolOptionCC1ViaLetPresentPos) { Invocation.generateCC1CommandLine(GeneratedArgs, *this); - ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fdebug-pass-manager"))); + ASSERT_EQ(count(GeneratedArgs, StringRef("-fdebug-pass-manager")), 1); ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fno-debug-pass-manager")))); } diff --git a/llvm/include/llvm/Option/OptParser.td b/llvm/include/llvm/Option/OptParser.td index 9e0ff14..d35a3e5 100644 --- a/llvm/include/llvm/Option/OptParser.td +++ b/llvm/include/llvm/Option/OptParser.td @@ -176,10 +176,10 @@ class MarshallingInfoBitfieldFlag<code keypath, code value> // 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. |