Skip to content

Commit

Permalink
rewriter: warn on multiple compile commands per src and truncate to f…
Browse files Browse the repository at this point in the history
…irst one
  • Loading branch information
kkysen committed Oct 1, 2024
1 parent ad0b26c commit 5ebdf79
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tools/rewriter/SourceRewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,14 @@ std::optional<Pkey> pkey_from_commands(std::function<std::optional<std::vector<C
return {};
}

if (comp_cmds.size() != 1) {
llvm::errs() << "warning: multiple compile commands for a single source file" << '\n'
<< " truncating to first compile command" << '\n'
<< " may not work properly" << '\n';
comp_cmds.resize(1);
}
assert(comp_cmds.size() == 1);

auto cc_cmd = *comp_cmd_with_pkey;

auto pkey_define = std::find_if(cc_cmd.CommandLine.begin(),
Expand Down

0 comments on commit 5ebdf79

Please sign in to comment.