diff options
| author | Ted Kremenek <kremenek@apple.com> | 2013-02-24 07:20:53 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2013-02-24 07:20:53 +0000 |
| commit | e3cf171730126cdfe29f24612de4cc13b813308a (patch) | |
| tree | fae984a0e5b6d83c65be23df3820178cef73f904 /clang/lib/StaticAnalyzer/Checkers | |
| parent | c4a90244bb1cb502e300b507de27f6498ad0eb3f (diff) | |
| download | bcm5719-llvm-e3cf171730126cdfe29f24612de4cc13b813308a.tar.gz bcm5719-llvm-e3cf171730126cdfe29f24612de4cc13b813308a.zip | |
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.
llvm-svn: 175987
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp index 3f8363762fd..f0ca8a8312b 100644 --- a/clang/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp @@ -75,9 +75,8 @@ UndefCapturedBlockVarChecker::checkPostStmt(const BlockExpr *BE, continue; // Get the VarRegion associated with VD in the local stack frame. - SVal VRVal = state->getSVal(I.getOriginalRegion()); - - if (VRVal.isUndef()) + if (Optional<UndefinedVal> V = + state->getSVal(I.getOriginalRegion()).getAs<UndefinedVal>()) { if (ExplodedNode *N = C.generateSink()) { if (!BT) BT.reset(new BuiltinBug("uninitialized variable captured by block")); @@ -92,11 +91,12 @@ UndefCapturedBlockVarChecker::checkPostStmt(const BlockExpr *BE, BugReport *R = new BugReport(*BT, os.str(), N); if (const Expr *Ex = FindBlockDeclRefExpr(BE->getBody(), VD)) R->addRange(Ex->getSourceRange()); - R->addVisitor(new FindLastStoreBRVisitor(VRVal, VR)); + R->addVisitor(new FindLastStoreBRVisitor(*V, VR)); R->disablePathPruning(); // need location of block C.emitReport(R); } + } } } |

