aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Maennich <maennich@google.com>2021-12-06 12:33:37 +0000
committerMatthias Maennich <maennich@google.com>2021-12-08 13:02:39 +0000
commit824b51875b53f137ebe663932e60c78eb42ccc90 (patch)
treef14312be222e5b70fb0a6029aa72a8cec1f9353e
parent136932d6136c6fc1197cd612de823c6146e6ad6d (diff)
downloadinterceptor-824b51875b53f137ebe663932e60c78eb42ccc90.tar.gz
interceptor: fix reporting of missing inputs
When missing inputs are reported, the Command's debug representation was printed before the inputs/outputs where filled. That is not ideal. Fix that by doing that check after the assignment. Signed-off-by: Matthias Maennich <maennich@google.com> Change-Id: I8cabd3243c9decee480daad151d69d4c77852b60
-rw-r--r--interceptor.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/interceptor.cc b/interceptor.cc
index 6c229b6..5e789ff 100644
--- a/interceptor.cc
+++ b/interceptor.cc
@@ -187,15 +187,15 @@ void Analyzer::set_inputs_outputs(Command* command) const {
output = output.substr(2);
}
}
- for (const auto& input : inputs) {
+ *command->mutable_inputs() = {inputs.begin(), inputs.end()};
+ *command->mutable_outputs() = {outputs.begin(), outputs.end()};
+
+ for (const auto& input : command->inputs()) {
if (!fs::is_regular_file(input)) {
std::cerr << "missing input: " << input << "\n" << *command << "\n";
exit(1);
}
}
-
- *command->mutable_inputs() = {inputs.begin(), inputs.end()};
- *command->mutable_outputs() = {outputs.begin(), outputs.end()};
}
class CompileLinkerAnalyzer : public Analyzer {