Renamed GRState::CheckerStatePrinter to GRState::Printer.
Updated checker state printer interface to allow transfer functions to return an arbitrary number of GRState::Printers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54762 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 2d69d9b..256072a 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -1211,10 +1211,10 @@
typedef llvm::DenseMap<GRExprEngine::NodeTy*, std::vector<SymbolID>*>
LeaksTy;
- class BindingsPrinter : public GRState::CheckerStatePrinter {
+ class BindingsPrinter : public GRState::Printer {
public:
- virtual void PrintCheckerState(std::ostream& Out, void* State,
- const char* nl, const char* sep);
+ virtual void Print(std::ostream& Out, const GRState* state,
+ const char* nl, const char* sep);
};
private:
@@ -1231,6 +1231,10 @@
static RefBindings GetRefBindings(const GRState& StImpl) {
return RefBindings((const RefBindings::TreeTy*) StImpl.CheckerState);
}
+
+ static RefBindings GetRefBindings(const GRState* state) {
+ return RefBindings((const RefBindings::TreeTy*) state->CheckerState);
+ }
private:
@@ -1272,8 +1276,8 @@
virtual void RegisterChecks(GRExprEngine& Eng);
- virtual GRState::CheckerStatePrinter* getCheckerStatePrinter() {
- return &Printer;
+ virtual void getStatePrinters(std::vector<GRState::Printer*>& Printers) {
+ Printers.push_back(&Printer);
}
bool isGCEnabled() const { return Summaries.isGCEnabled(); }
@@ -1363,12 +1367,12 @@
-void CFRefCount::BindingsPrinter::PrintCheckerState(std::ostream& Out,
- void* State, const char* nl,
- const char* sep) {
- RefBindings B((RefBindings::TreeTy*) State);
+void CFRefCount::BindingsPrinter::Print(std::ostream& Out, const GRState* state,
+ const char* nl, const char* sep) {
+
+ RefBindings B = GetRefBindings(state);
- if (State)
+ if (!B.isEmpty())
Out << sep << nl;
for (RefBindings::iterator I=B.begin(), E=B.end(); I!=E; ++I) {