Skip to content

Commit 51fe854

Browse files
john-brawn-armmemfrob
authored and
memfrob
committed
[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
1 parent 40204df commit 51fe854

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ static void denormalizeStringImpl(SmallVectorImpl<const char *> &Args,
211211
switch (OptClass) {
212212
case Option::SeparateClass:
213213
case Option::JoinedOrSeparateClass:
214+
case Option::JoinedAndSeparateClass:
214215
Args.push_back(Spelling);
215216
Args.push_back(SA(Value));
216217
break;
@@ -2477,9 +2478,13 @@ static void GenerateFrontendArgs(const FrontendOptions &Opts,
24772478

24782479
GenerateProgramAction();
24792480

2480-
for (const auto &PluginArgs : Opts.PluginArgs)
2481+
for (const auto &PluginArgs : Opts.PluginArgs) {
2482+
Option Opt = getDriverOptTable().getOption(OPT_plugin_arg);
2483+
const char *Spelling =
2484+
SA(Opt.getPrefix() + Opt.getName() + PluginArgs.first);
24812485
for (const auto &PluginArg : PluginArgs.second)
2482-
GenerateArg(Args, OPT_plugin_arg, PluginArgs.first + PluginArg, SA);
2486+
denormalizeString(Args, Spelling, SA, Opt.getKind(), 0, PluginArg);
2487+
}
24832488

24842489
for (const auto &Ext : Opts.ModuleFileExtensions)
24852490
if (auto *TestExt = dyn_cast_or_null<TestModuleFileExtension>(Ext.get()))

0 commit comments

Comments
 (0)