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

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 27 04:51:09 PST 2021


jansvoboda11 added a comment.

In D94472#2523053 <https://reviews.llvm.org/D94472#2523053>, @Bigcheese wrote:

> The only issue I have with this if always parsing twice has a noticeable performance impact for any users of Clang. Can we measure the impact? If it's small (< 100ms ?) then that's fine. I'm also concerned about users like cling and clangd.

I've created a micro-benchmark in D95516 <https://reviews.llvm.org/D95516>. I think we should be fine.

In D94472#2523490 <https://reviews.llvm.org/D94472#2523490>, @dexonsmith wrote:

> I think the idea is only to parse twice when `-round-trip-args` is on, which the driver will only set by default in asserts mode. Good to measure the impact nevertheless.

I must've misunderstood you earlier. I've updated the patch so that we round-trip only when cc1 is given `-round-trip-args` (which happens automatically only in assert builds).
We check that the once- and twice- generated arguments match, and we make sure the `CompilerInvocation` resulting from the second parse gets used in the rest of compilation.



================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:604
+                 GenArgs2Strs.end(), [](const char *A, const char *B) {
+                   return StringRef(A) == StringRef(B);
+                 });
----------------
There must be a better way to do this...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94472



More information about the cfe-commits mailing list