[PATCH] D94472: [clang][cli] Command line round-trip for HeaderSearch options

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 27 12:44:19 PST 2021


dexonsmith added inline comments.


================
Comment at: clang/include/clang/Driver/Options.td:593-594
 
+def round_trip_args : Flag<["-"], "round-trip-args">, Flags<[CC1Option, NoDriverOption]>,
+  HelpText<"Performs 'parse-generate-parse' round-trip of command line arguments.">;
+def round_trip_args_debug : Flag<["-"], "round-trip-args-debug">, Flags<[CC1Option, NoDriverOption]>,
----------------
Can we make this `=true` vs. `=false`, or add a `-no-round-trip-args`? That will allow:
```
% clang some args -Xclang -no-round-trip-args
```
to disable it in asserts builds; much better than:
```
% clang some args -###
# Search for -round-trip-args
% clang -cc1 copy-paste-args-before copy-past-args-after
```


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:531
+  Option Opt = getDriverOptTable().getOption(OptSpecifier);
+  denormalizeSimpleFlag(Args, SA(Opt.getPrefix() + Opt.getName()), SA,
+                        Option::OptionClass::FlagClass, 0);
----------------
Hmm, I thought we'd found a way to avoid allocating the prefixed name, by adding it to the options table. This unfortunate, but I guess you can fix it another time.




================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:540
+  Option Opt = getDriverOptTable().getOption(OptSpecifier);
+  denormalizeString(Args, SA(Opt.getPrefix() + Opt.getName()), SA,
+                    Opt.getKind(), 0, Value);
----------------
Does this allocated string get used, or does `"=some-value"` get added on?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94472/new/

https://reviews.llvm.org/D94472



More information about the llvm-commits mailing list