[PATCH] D106562: [clangd] Get rid of arg adjusters in CommandMangler

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 23 06:14:14 PDT 2021


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

This raises the question "is it safe to move functionality from CommandMangler to buildCompilerInvocation for convenience, are they always called on the same codepaths?"

I think from our brief investigation the answer is yes, but:

- this expectation should probably be documented on CommandMangler and/or buildCompilerInvocation
- *neither* of them are called when background indexing, which should probably be a fixme on the static indexer



================
Comment at: clang-tools-extra/clangd/CompileCommands.cpp:225
+    auto It = llvm::find(Cmd, "--");
+    for (std::string &Arg : ToAppend)
+      Cmd.insert(It++, std::move(Arg));
----------------
oops, might have left this comment on the wrong patch

use range insert to save shuffling the tail over and over and std::make_move_iterator() to avoid copies?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106562



More information about the cfe-commits mailing list