aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Analysis/PathSensitive/BasicValueFactory.h4
-rw-r--r--include/clang/Analysis/PathSensitive/SVals.h6
-rw-r--r--lib/Analysis/SVals.cpp21
3 files changed, 30 insertions, 1 deletions
diff --git a/include/clang/Analysis/PathSensitive/BasicValueFactory.h b/include/clang/Analysis/PathSensitive/BasicValueFactory.h
index 82ed8558be..a8995b149f 100644
--- a/include/clang/Analysis/PathSensitive/BasicValueFactory.h
+++ b/include/clang/Analysis/PathSensitive/BasicValueFactory.h
@@ -33,6 +33,10 @@ public:
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);
diff --git a/include/clang/Analysis/PathSensitive/SVals.h b/include/clang/Analysis/PathSensitive/SVals.h
index 8cc993e1a3..91fb71e6df 100644
--- a/include/clang/Analysis/PathSensitive/SVals.h
+++ b/include/clang/Analysis/PathSensitive/SVals.h
@@ -324,9 +324,13 @@ class CompoundVal : public NonLoc {
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;
diff --git a/lib/Analysis/SVals.cpp b/lib/Analysis/SVals.cpp
index 1fb5875693..bba0bde12a 100644
--- a/lib/Analysis/SVals.cpp
+++ b/lib/Analysis/SVals.cpp
@@ -55,6 +55,18 @@ SVal::symbol_iterator SVal::symbol_end() const {
}
//===----------------------------------------------------------------------===//
+// 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 @@ void NonLoc::print(llvm::raw_ostream& Out) const {
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;