aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorJohn Brawn <john.brawn@arm.com>2021-03-30 18:33:10 +0100
committerJohn Brawn <john.brawn@arm.com>2021-03-30 18:33:10 +0100
commiteae3b2a715d7fd1aea0ce1c78ac7a04957b72728 (patch)
tree2238c7e62b9eac2c10cd22c94e56b4199ab04639 /clang/lib/Frontend/CompilerInvocation.cpp
parent700431128e212d5ef53afb6d20da098ca264cadd (diff)
downloadllvm-eae3b2a715d7fd1aea0ce1c78ac7a04957b72728.zip
llvm-eae3b2a715d7fd1aea0ce1c78ac7a04957b72728.tar.gz
llvm-eae3b2a715d7fd1aea0ce1c78ac7a04957b72728.tar.bz2
[clang][cli] Fix round-trip of OPT_plugin_arg
The test Frontend/plugin-delayed-template.cpp is failing when asserts are enabled because it hits an assertion in denormalizeStringImpl when trying to round-trip OPT_plugin_arg. Fix this by adjusting how the option is handled, as the first part is joined to -plugin-arg and the second is separate. Differential Revision: https://reviews.llvm.org/D99606
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 490672b..b18bc0b 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -211,6 +211,7 @@ static void denormalizeStringImpl(SmallVectorImpl<const char *> &Args,
switch (OptClass) {
case Option::SeparateClass:
case Option::JoinedOrSeparateClass:
+ case Option::JoinedAndSeparateClass:
Args.push_back(Spelling);
Args.push_back(SA(Value));
break;
@@ -2477,9 +2478,13 @@ static void GenerateFrontendArgs(const FrontendOptions &Opts,
GenerateProgramAction();
- for (const auto &PluginArgs : Opts.PluginArgs)
+ for (const auto &PluginArgs : Opts.PluginArgs) {
+ Option Opt = getDriverOptTable().getOption(OPT_plugin_arg);
+ const char *Spelling =
+ SA(Opt.getPrefix() + Opt.getName() + PluginArgs.first);
for (const auto &PluginArg : PluginArgs.second)
- GenerateArg(Args, OPT_plugin_arg, PluginArgs.first + PluginArg, SA);
+ denormalizeString(Args, Spelling, SA, Opt.getKind(), 0, PluginArg);
+ }
for (const auto &Ext : Opts.ModuleFileExtensions)
if (auto *TestExt = dyn_cast_or_null<TestModuleFileExtension>(Ext.get()))