[analyzer][NFC] Add RangeSet::dump

This tiny change improves the debugging experience of the solver a lot!

Differential Revision: https://reviews.llvm.org/D110911
This commit is contained in:
Gabor Marton 2021-09-30 23:24:17 +02:00
parent b096ac9092
commit b8f6c85a83
2 changed files with 6 additions and 2 deletions

View File

@ -48,6 +48,7 @@ public:
ID.AddPointer(&To());
}
void dump(raw_ostream &OS) const;
void dump() const;
// In order to keep non-overlapping ranges sorted, we can compare only From
// points.
@ -282,6 +283,7 @@ public:
bool contains(llvm::APSInt Point) const { return containsImpl(Point); }
void dump(raw_ostream &OS) const;
void dump() const;
bool operator==(const RangeSet &Other) const { return *Impl == *Other.Impl; }
bool operator!=(const RangeSet &Other) const { return !(*this == Other); }

View File

@ -494,15 +494,17 @@ RangeSet RangeSet::Factory::deletePoint(RangeSet From,
return intersect(From, Upper, Lower);
}
void Range::dump(raw_ostream &OS) const {
LLVM_DUMP_METHOD void Range::dump(raw_ostream &OS) const {
OS << '[' << toString(From(), 10) << ", " << toString(To(), 10) << ']';
}
LLVM_DUMP_METHOD void Range::dump() const { dump(llvm::errs()); }
void RangeSet::dump(raw_ostream &OS) const {
LLVM_DUMP_METHOD void RangeSet::dump(raw_ostream &OS) const {
OS << "{ ";
llvm::interleaveComma(*this, OS, [&OS](const Range &R) { R.dump(OS); });
OS << " }";
}
LLVM_DUMP_METHOD void RangeSet::dump() const { dump(llvm::errs()); }
REGISTER_SET_FACTORY_WITH_PROGRAMSTATE(SymbolSet, SymbolRef)