[cfe-commits] r58442 - in /cfe/trunk: include/clang/Analysis/PathSensitive/BasicValueFactory.h include/clang/Analysis/PathSensitive/SVals.h lib/Analysis/SVals.cpp
Ted Kremenek
kremenek at apple.com
Thu Oct 30 11:01:28 PDT 2008
Author: kremenek
Date: Thu Oct 30 13:01:28 2008
New Revision: 58442
URL: http://llvm.org/viewvc/llvm-project?rev=58442&view=rev
Log:
Added iterators to nonloc::CompoundSVal.
Added pretty-printing for nonloc::CompoundSVal.
Modified:
cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h
cfe/trunk/include/clang/Analysis/PathSensitive/SVals.h
cfe/trunk/lib/Analysis/SVals.cpp
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h?rev=58442&r1=58441&r2=58442&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h Thu Oct 30 13:01:28 2008
@@ -33,6 +33,10 @@
CompoundValData(QualType t, llvm::ImmutableList<SVal> l)
: T(t), L(l) {}
+ typedef llvm::ImmutableList<SVal>::iterator iterator;
+ iterator begin() const { return L.begin(); }
+ iterator end() const { return L.end(); }
+
static void Profile(llvm::FoldingSetNodeID& ID, QualType T,
llvm::ImmutableList<SVal> L);
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/SVals.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/SVals.h?rev=58442&r1=58441&r2=58442&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/SVals.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/SVals.h Thu Oct 30 13:01:28 2008
@@ -324,9 +324,13 @@
CompoundVal(const CompoundValData* D) : NonLoc(CompoundValKind, D) {}
public:
- const CompoundValData* getValue() {
+ const CompoundValData* getValue() const {
return static_cast<CompoundValData*>(Data);
}
+
+ typedef llvm::ImmutableList<SVal>::iterator iterator;
+ iterator begin() const;
+ iterator end() const;
static bool classof(const SVal* V) {
return V->getBaseKind() == NonLocKind && V->getSubKind() == CompoundValKind;
Modified: cfe/trunk/lib/Analysis/SVals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/SVals.cpp?rev=58442&r1=58441&r2=58442&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/SVals.cpp (original)
+++ cfe/trunk/lib/Analysis/SVals.cpp Thu Oct 30 13:01:28 2008
@@ -55,6 +55,18 @@
}
//===----------------------------------------------------------------------===//
+// Other Iterators.
+//===----------------------------------------------------------------------===//
+
+nonloc::CompoundVal::iterator nonloc::CompoundVal::begin() const {
+ return getValue()->begin();
+}
+
+nonloc::CompoundVal::iterator nonloc::CompoundVal::end() const {
+ return getValue()->end();
+}
+
+//===----------------------------------------------------------------------===//
// Useful predicates.
//===----------------------------------------------------------------------===//
@@ -484,6 +496,15 @@
break;
}
+ case nonloc::CompoundValKind: {
+ const nonloc::CompoundVal& C = *cast<nonloc::CompoundVal>(this);
+ Out << " { ";
+ for (nonloc::CompoundVal::iterator I=C.begin(), E=C.end(); I!=E; ++I)
+ (*I).print(Out);
+ Out << " }";
+ break;
+ }
+
default:
assert (false && "Pretty-printed not implemented for this NonLoc.");
break;
More information about the cfe-commits
mailing list