aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clangd/CompileCommands.cpp
diff options
context:
space:
mode:
authorNathan Ridge <zeratul976@hotmail.com>2025-09-03 02:37:53 -0400
committerNathan Ridge <zeratul976@hotmail.com>2025-09-22 00:32:45 -0400
commit9ed89b70375baf1c89086fe773da1cf24ac5c656 (patch)
tree2f21fa0e9f4ee28a6e6acc5cbbd0dbd083b39fc7 /clang-tools-extra/clangd/CompileCommands.cpp
parent84a796d7dd09a4a6d64a30d47405cf60e59534c1 (diff)
downloadllvm-users/HighCommander4/clangd-issue-1850-part1.zip
llvm-users/HighCommander4/clangd-issue-1850-part1.tar.gz
llvm-users/HighCommander4/clangd-issue-1850-part1.tar.bz2
[clangd] Fix off-by-one error in CommandManglerusers/HighCommander4/clangd-issue-1850-part1
SawInput() is intended to be called for every argument after a `--`, but it was mistakenly being called for the `--` itself. Partially fixes https://github.com/clangd/clangd/issues/1850
Diffstat (limited to 'clang-tools-extra/clangd/CompileCommands.cpp')
-rw-r--r--clang-tools-extra/clangd/CompileCommands.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/CompileCommands.cpp b/clang-tools-extra/clangd/CompileCommands.cpp
index 80391fe..c9da98e 100644
--- a/clang-tools-extra/clangd/CompileCommands.cpp
+++ b/clang-tools-extra/clangd/CompileCommands.cpp
@@ -270,7 +270,8 @@ void CommandMangler::operator()(tooling::CompileCommand &Command,
if (auto *DashDash =
ArgList.getLastArgNoClaim(driver::options::OPT__DASH_DASH)) {
auto DashDashIndex = DashDash->getIndex() + 1; // +1 accounts for Cmd[0]
- for (unsigned I = DashDashIndex; I < Cmd.size(); ++I)
+ // Another +1 so we don't treat the `--` itself as an input.
+ for (unsigned I = DashDashIndex + 1; I < Cmd.size(); ++I)
SawInput(Cmd[I]);
Cmd.resize(DashDashIndex);
}