diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-08-19 22:24:03 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-08-19 22:24:03 +0000 |
commit | a622d8c2719e927b47f48dbebcece770e752dfb8 (patch) | |
tree | 5acc0bc1b88bb90500750dd7450abb227c994a4c /lib | |
parent | caa3724b1d525a888982f94a6ae2b527eb3bca7d (diff) |
Move store pretty-printing logic inside of StoreManager (previously in GRState).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55013 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/BasicStore.cpp | 23 | ||||
-rw-r--r-- | lib/Analysis/GRState.cpp | 24 |
2 files changed, 28 insertions, 19 deletions
diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp index 15284567e6..24ec7f0e38 100644 --- a/lib/Analysis/BasicStore.cpp +++ b/lib/Analysis/BasicStore.cpp @@ -16,6 +16,7 @@ #include "clang/Analysis/PathSensitive/GRState.h" #include "llvm/ADT/ImmutableMap.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/Streams.h" using namespace clang; @@ -42,7 +43,10 @@ public: static inline VarBindingsTy GetVarBindings(Store store) { return VarBindingsTy(static_cast<const VarBindingsTy::TreeTy*>(store)); - } + } + + virtual void print(Store store, std::ostream& Out, + const char* nl, const char *sep); }; } // end anonymous namespace @@ -234,3 +238,20 @@ Store BasicStoreManager::getInitialStore(GRStateManager& StateMgr) { } return St; } + +void BasicStoreManager::print(Store store, std::ostream& Out, + const char* nl, const char *sep) { + + VarBindingsTy B = GetVarBindings(store); + Out << "Variables:" << nl; + + bool isFirst = true; + + for (VarBindingsTy::iterator I=B.begin(), E=B.end(); I != E; ++I) { + if (isFirst) isFirst = false; + else Out << nl; + + Out << ' ' << I.getKey()->getName() << " : "; + I.getData().print(Out); + } +} diff --git a/lib/Analysis/GRState.cpp b/lib/Analysis/GRState.cpp index e4022a2663..23467e2046 100644 --- a/lib/Analysis/GRState.cpp +++ b/lib/Analysis/GRState.cpp @@ -238,26 +238,15 @@ const GRState* GRStateManager::getPersistentState(GRState& State) { // State pretty-printing. //===----------------------------------------------------------------------===// -void GRState::print(std::ostream& Out, Printer** Beg, Printer** End, +void GRState::print(std::ostream& Out, StoreManager& StoreMgr, + Printer** Beg, Printer** End, const char* nl, const char* sep) const { - - // Print Variable Bindings - Out << "Variables:" << nl; - bool isFirst = true; - - for (vb_iterator I = vb_begin(), E = vb_end(); I != E; ++I) { - - if (isFirst) isFirst = false; - else Out << nl; - - Out << ' ' << I.getKey()->getName() << " : "; - I.getData().print(Out); - } + // Print the store. + StoreMgr.print(getStore(), Out, nl, sep); // Print Subexpression bindings. - - isFirst = true; + bool isFirst = true; for (seb_iterator I = seb_begin(), E = seb_end(); I != E; ++I) { @@ -274,7 +263,6 @@ void GRState::print(std::ostream& Out, Printer** Beg, Printer** End, } // Print block-expression bindings. - isFirst = true; for (beb_iterator I = beb_begin(), E = beb_end(); I != E; ++I) { @@ -341,7 +329,7 @@ void GRStateRef::printStdErr() const { void GRStateRef::print(std::ostream& Out, const char* nl, const char* sep)const{ GRState::Printer **beg = Mgr->Printers.empty() ? 0 : &Mgr->Printers[0]; GRState::Printer **end = !beg ? 0 : beg + Mgr->Printers.size(); - St->print(Out, beg, end, nl, sep); + St->print(Out, *Mgr->StMgr, beg, end, nl, sep); } //===----------------------------------------------------------------------===// |