[cfe-commits] r47894 - in /cfe/trunk: Analysis/ValueState.cpp include/clang/Analysis/PathSensitive/ValueState.h
Ted Kremenek
kremenek at apple.com
Tue Mar 4 10:30:35 PST 2008
Author: kremenek
Date: Tue Mar 4 12:30:35 2008
New Revision: 47894
URL: http://llvm.org/viewvc/llvm-project?rev=47894&view=rev
Log:
Implemented "print" method for ValueState.
Modified:
cfe/trunk/Analysis/ValueState.cpp
cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h
Modified: cfe/trunk/Analysis/ValueState.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/ValueState.cpp?rev=47894&r1=47893&r2=47894&view=diff
==============================================================================
--- cfe/trunk/Analysis/ValueState.cpp (original)
+++ cfe/trunk/Analysis/ValueState.cpp Tue Mar 4 12:30:35 2008
@@ -486,16 +486,22 @@
}
void ValueState::printDOT(std::ostream& Out) const {
+ print(Out, "\\l", "\\|");
+}
+
+void ValueState::print(std::ostream& Out,
+ const char* nl,
+ const char* sep) const {
// Print Variable Bindings
- Out << "Variables:\\l";
+ Out << "Variables:" << nl;
bool isFirst = true;
for (vb_iterator I = vb_begin(), E = vb_end(); I != E; ++I) {
if (isFirst) isFirst = false;
- else Out << "\\l";
+ else Out << nl;
Out << ' ' << I.getKey()->getName() << " : ";
I.getData().print(Out);
@@ -508,10 +514,10 @@
for (seb_iterator I = seb_begin(), E = seb_end(); I != E; ++I) {
if (isFirst) {
- Out << "\\l\\lSub-Expressions:\\l";
+ Out << nl << nl << "Sub-Expressions:" << nl;
isFirst = false;
}
- else { Out << "\\l"; }
+ else { Out << nl; }
Out << " (" << (void*) I.getKey() << ") ";
I.getKey()->printPretty(Out);
@@ -526,10 +532,10 @@
for (beb_iterator I = beb_begin(), E = beb_end(); I != E; ++I) {
if (isFirst) {
- Out << "\\l\\lBlock-level Expressions:\\l";
+ Out << nl << nl << "Block-level Expressions:" << nl;
isFirst = false;
}
- else { Out << "\\l"; }
+ else { Out << nl; }
Out << " (" << (void*) I.getKey() << ") ";
I.getKey()->printPretty(Out);
@@ -541,12 +547,12 @@
if (!ConstEq.isEmpty()) {
- Out << "\\l\\|'==' constraints:";
+ Out << nl << sep << "'==' constraints:";
for (ConstEqTy::iterator I = ConstEq.begin(),
E = ConstEq.end(); I!=E; ++I) {
- Out << "\\l $" << I.getKey()
+ Out << nl << " $" << I.getKey()
<< " : " << I.getData()->toString();
}
}
@@ -555,12 +561,12 @@
if (!ConstNotEq.isEmpty()) {
- Out << "\\l\\|'!=' constraints:";
+ Out << nl << sep << "'!=' constraints:";
for (ConstNotEqTy::iterator I = ConstNotEq.begin(),
EI = ConstNotEq.end(); I != EI; ++I) {
- Out << "\\l $" << I.getKey() << " : ";
+ Out << nl << " $" << I.getKey() << " : ";
isFirst = true;
IntSetTy::iterator J = I.getData().begin(), EJ = I.getData().end();
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h?rev=47894&r1=47893&r2=47894&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h Tue Mar 4 12:30:35 2008
@@ -133,10 +133,13 @@
typedef ConstEqTy::iterator ce_iterator;
ce_iterator ce_begin() const { return ConstEq.begin(); }
ce_iterator ce_end() const { return ConstEq.end(); }
+
+ void print(std::ostream& Out,
+ const char* nl = "\n",
+ const char* sep = "") const;
- void printDOT(std::ostream& Out) const;
- void print(std::ostream& Out) const;
void printStdErr() const { print(*llvm::cerr); }
+ void printDOT(std::ostream& Out) const;
};
template<> struct GRTrait<ValueState*> {
More information about the cfe-commits
mailing list