Skip to content

Commit

Permalink
[llvm-diff] add "reset" method to DiffConsumer
Browse files Browse the repository at this point in the history
A DiffConsumer object may be reused, but we'd like to reset it before
the next use.

No functionality change intended.

Differential Revision: https://reviews.llvm.org/D107985
  • Loading branch information
isanbard committed Aug 12, 2021
1 parent 56d6070 commit 39809eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions llvm/tools/llvm-diff/lib/DiffConsumer.cpp
Expand Up @@ -134,6 +134,12 @@ void DiffConsumer::indent() {
while (N--) out << ' ';
}

void DiffConsumer::reset() {
context.clear();
Differences = false;
Indent = 0;
}

bool DiffConsumer::hadDifferences() const {
return Differences;
}
Expand Down
1 change: 1 addition & 0 deletions llvm/tools/llvm-diff/lib/DiffConsumer.h
Expand Up @@ -78,6 +78,7 @@ class StringRef;
DiffConsumer()
: out(errs()), Differences(false), Indent(0) {}

void reset();
bool hadDifferences() const;
void enterContext(const Value *L, const Value *R) override;
void exitContext() override;
Expand Down

0 comments on commit 39809eb

Please sign in to comment.