Skip to content

Commit

Permalink
Rename formal parameter to report_to_false. (#5650)
Browse files Browse the repository at this point in the history
Clarifies that the string parameter to report_to_false is supposed to be
the invariant name.
  • Loading branch information
abhinav92003 committed Sep 14, 2022
1 parent 6ea013e commit d941df9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions clients/drcachesim/tests/invariant_checker_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ class checker_no_abort_t : public invariant_checker_t {
protected:
void
report_if_false(per_shard_t *shard, bool condition,
const std::string &message) override
const std::string &invariant_name) override
{
if (!condition) {
errors.push_back(message);
errors.push_back(invariant_name);
error_tids.push_back(shard->tid);
error_refs.push_back(shard->ref_count);
}
Expand Down
4 changes: 2 additions & 2 deletions clients/drcachesim/tools/invariant_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ invariant_checker_t::~invariant_checker_t()

void
invariant_checker_t::report_if_false(per_shard_t *shard, bool condition,
const std::string &message)
const std::string &invariant_name)
{
if (!condition) {
std::cerr << "Trace invariant failure in T" << shard->tid << " at ref # "
<< shard->ref_count << ": " << message << "\n";
<< shard->ref_count << ": " << invariant_name << "\n";
abort();
}
}
Expand Down
3 changes: 2 additions & 1 deletion clients/drcachesim/tools/invariant_checker.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ class invariant_checker_t : public analysis_tool_t {
// We provide this for subclasses to run these invariants with custom
// failure reporting.
virtual void
report_if_false(per_shard_t *shard, bool condition, const std::string &message);
report_if_false(per_shard_t *shard, bool condition,
const std::string &invariant_name);

// The keys here are int for parallel, tid for serial.
std::unordered_map<memref_tid_t, std::unique_ptr<per_shard_t>> shard_map_;
Expand Down

0 comments on commit d941df9

Please sign in to comment.