diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-02-16 08:33:59 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-02-16 08:33:59 +0000 |
commit | 94fd0b8c88db9b1cd99457d3cd8cd333341dd39c (patch) | |
tree | aacf7dcf58f0a413b1a325bb9da5a78f64090876 /lib/Checker/BugReporterVisitors.cpp | |
parent | 3dbd3d5c04cd5abd7dfd83b15f51d7c610a3c512 (diff) |
Add simpler checker to check if variables captured by a block are uninitialized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96341 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/BugReporterVisitors.cpp')
-rw-r--r-- | lib/Checker/BugReporterVisitors.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/Checker/BugReporterVisitors.cpp b/lib/Checker/BugReporterVisitors.cpp index b8f657b31b..6cf41b14dc 100644 --- a/lib/Checker/BugReporterVisitors.cpp +++ b/lib/Checker/BugReporterVisitors.cpp @@ -323,7 +323,7 @@ void clang::bugreporter::registerTrackNullOrUndefValue(BugReporterContext& BRC, if (isa<loc::ConcreteInt>(V) || isa<nonloc::ConcreteInt>(V) || V.isUndef()) { - registerFindLastStore(BRC, R, V); + ::registerFindLastStore(BRC, R, V); } } } @@ -347,3 +347,21 @@ void clang::bugreporter::registerTrackNullOrUndefValue(BugReporterContext& BRC, } } } + +void clang::bugreporter::registerFindLastStore(BugReporterContext& BRC, + const void *data, + const ExplodedNode* N) { + + const MemRegion *R = static_cast<const MemRegion*>(data); + + if (!R) + return; + + const GRState *state = N->getState(); + SVal V = state->getSVal(R); + + if (V.isUnknown()) + return; + + BRC.addVisitor(new FindLastStoreBRVisitor(V, R)); +} |