Pushes input for the compile action to the end while separating with a
-- before applying other manglings. This ensures edits that effect only the
arguments that come after them works, like changing parse language via -x.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang-tools-extra/clangd/CompileCommands.cpp | ||
---|---|---|
212 | More than one input is a really annoying error to diagnose, would we want to detect and log it here? Downside is this code runs *really* often. | |
231–232 | These are copies of the rendered arg list, i think many of them we could replace with calls to ArgList.erase before rendering the arg list. ... but wait, is "rendering the arglist" even possible? (I want to expand the scope of this patch unneccesarily, but it might be a way to offset the extra costs...) | |
238 | Technically the hasArgNoClaim is stale, we've applied edits to the command since then. Probably fine though, not much use for setting resource-dir. (maybe we should even drop this check) hasArgNoClaim is probably cheaper than the old scan we were doing, but its impl is crazy: not a simple scan, but also not a simple lookup. | |
242 | OTOH the edits may well set sysroot or isysroot, i'm not sure this is valid :-( | |
247–248 | while here and worrying about efficiency - should we just search for '--' ourselves? |
clang-tools-extra/clangd/CompileCommands.cpp | ||
---|---|---|
212 | Another option would be to delete all the OPT_INPUTs and append the actual filename (CompileCommand::Filename) This seems like it would define this class of errors out of existence, maybe? Layering doesn't make it easy to do that right here, though :-\ |
clang-tools-extra/clangd/CompileCommands.cpp | ||
---|---|---|
212 | I agree that it is gonna be somewhat noisy. But I think it is gonna effect 2 different workflows:
So maybe we can make it vlog instead, and ensure it only shows up to users that care? | |
212 | yes this sounds great indeed, send out as a separate follow-up in D106639. | |
231–232 | send out D106562 to get rid of these. | |
238 | keeping the Has behaviour just to minimize the impact, happy to drop the check as a follow-up. |
Still LG
clang-tools-extra/clangd/CompileCommands.cpp | ||
---|---|---|
250 | 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()));? | |
256 | you reverted the others to Has but keps the ArgList reference here. |
More than one input is a really annoying error to diagnose, would we want to detect and log it here? Downside is this code runs *really* often.