diff options
Diffstat (limited to 'include/clang/StaticAnalyzer/Core')
-rw-r--r-- | include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h | 13 | ||||
-rw-r--r-- | include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h | 15 |
2 files changed, 19 insertions, 9 deletions
diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h index 75bf9613e2..bef4b30a35 100644 --- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h +++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h @@ -99,7 +99,7 @@ class FindLastStoreBRVisitor { const MemRegion *R; SVal V; - bool satisfied; + bool Satisfied; public: /// \brief Convenience method to create a visitor given only the MemRegion. @@ -112,13 +112,10 @@ public: /// the BugReport. static void registerStatementVarDecls(BugReport &BR, const Stmt *S); - FindLastStoreBRVisitor(SVal v, const MemRegion *r) - : R(r), V(v), satisfied(false) { - assert (!V.isUnknown() && "Cannot track unknown value."); - - // TODO: Does it make sense to allow undef values here? - // (If not, also see UndefCapturedBlockVarChecker)? - } + FindLastStoreBRVisitor(KnownSVal V, const MemRegion *R) + : R(R), + V(V), + Satisfied(false) {} void Profile(llvm::FoldingSetNodeID &ID) const; 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() {} |