[PATCH] D106527: [clangd] Canonicalize compile flags before applying edits

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 23 05:32:24 PDT 2021


sammccall accepted this revision.
sammccall added a comment.

Still LG



================
Comment at: clang-tools-extra/clangd/CompileCommands.cpp:250
     auto It = llvm::find(Cmd, "--");
     for (std::string &Arg : ToAppend)
       Cmd.insert(It++, std::move(Arg));
----------------
hmm, why isn't this `Cmd.insert(It, ToAppend.begin(), ToAppend.end())` instead of the loop, to avoid shuffling the tail elements?

Or in fact `Cmd.insert(It, std::make_move_iterator(ToAppend.begin()), std::make_move_iterator(ToAppend.end()));`?


================
Comment at: clang-tools-extra/clangd/CompileCommands.cpp:256
+    bool FollowSymlink =
+        !ArgList.hasArgNoClaim(driver::options::OPT_no_canonical_prefixes);
     Cmd.front() =
----------------
you reverted the others to Has but keps the ArgList reference here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106527



More information about the cfe-commits mailing list