[PATCH] D99606: [clang][cli] Fix round-trip of OPT_plugin_arg
John Brawn via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 30 09:42:49 PDT 2021
john.brawn created this revision.
john.brawn added reviewers: jansvoboda11, dexonsmith, Bigcheese.
john.brawn requested review of this revision.
Herald added a project: clang.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99606
Files:
clang/lib/Frontend/CompilerInvocation.cpp
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -211,6 +211,7 @@
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 @@
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()))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99606.334199.patch
Type: text/x-patch
Size: 1095 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210330/9adfc0db/attachment.bin>
More information about the cfe-commits
mailing list