[PATCH] D106639: [clangd] Adjust compile flags to contain only the requested file as input
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 23 06:18:51 PDT 2021
sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang-tools-extra/clangd/CompileCommands.cpp:216
+ for (auto *Input : ArgList.filtered(driver::options::OPT_INPUT)) {
+ // Driver name is also considered an input, don't strip that away.
+ if (Input->getIndex() == 0)
----------------
Is this because we're not meant to be parsing argv0?
Maybe check that and fix that here if so, or leave a FIXME if we don't want to check now?
================
Comment at: clang-tools-extra/clangd/CompileCommands.cpp:226
+ [&Cmd](unsigned Idx) { Cmd.erase(Cmd.begin() + Idx); });
+ Cmd.insert(Cmd.end(), {"--", File.str()});
}
----------------
nit: Fairly sure this is copying File twice, init-lists are dumb. maybe just two push_backs instead?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106639/new/
https://reviews.llvm.org/D106639
More information about the cfe-commits
mailing list