aboutsummaryrefslogtreecommitdiff
path: root/include/clang/StaticAnalyzer/Core/PathSensitive
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2013-02-24 07:20:53 +0000
committerTed Kremenek <kremenek@apple.com>2013-02-24 07:20:53 +0000
commit0dd15d78fb0c99faa5df724139ba4c16a9a345c6 (patch)
treeb2c2e938776913263a1fd631f8ffa21db0ff594b /include/clang/StaticAnalyzer/Core/PathSensitive
parent026cd1a273d16eaa9a66be92f38b1f907202e542 (diff)
Add "KnownSVal" to represent SVals that cannot be UnknownSVal.
This provides a few sundry cleanups, and allows us to provide a compile-time check for a case that was a runtime assertion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175987 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/StaticAnalyzer/Core/PathSensitive')
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
index 31d02f51ea..03e84447e7 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
@@ -219,7 +219,7 @@ public:
private:
friend class SVal;
- static bool isKind(const SVal& V) {
+ static bool isKind(const SVal &V) {
return V.getBaseKind() == UnknownKind;
}
};
@@ -242,6 +242,19 @@ private:
}
};
+
+/// \brief Represents an SVal that is guaranteed to not be UnknownVal.
+class KnownSVal : public SVal {
+ KnownSVal() {}
+ friend class SVal;
+ static bool isKind(const SVal &V) {
+ return !V.isUnknown();
+ }
+public:
+ KnownSVal(const DefinedSVal &V) : SVal(V) {}
+ KnownSVal(const UndefinedVal &V) : SVal(V) {}
+};
+
class NonLoc : public DefinedSVal {
protected:
NonLoc() {}