diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-02-20 05:52:05 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-02-20 05:52:05 +0000 |
commit | 5251abea41b446c26e3239c8dd6c7edea6fc335d (patch) | |
tree | 09e0e6ebf4f25817514dc7367d988f679bddb771 /lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp | |
parent | a905c4fd256396b589013304d9793cc199b8a0c6 (diff) |
Replace SVal llvm::cast support to be well-defined.
See r175462 for another example/more details.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175594 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp b/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp index 3af793c23f..6185a8ee8c 100644 --- a/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp @@ -51,13 +51,13 @@ void AttrNonNullChecker::checkPreCall(const CallEvent &Call, continue; SVal V = Call.getArgSVal(idx); - DefinedSVal *DV = dyn_cast<DefinedSVal>(&V); + llvm::Optional<DefinedSVal> DV = V.getAs<DefinedSVal>(); // If the value is unknown or undefined, we can't perform this check. if (!DV) continue; - if (!isa<Loc>(*DV)) { + if (!DV->getAs<Loc>()) { // If the argument is a union type, we want to handle a potential // transparent_union GCC extension. const Expr *ArgE = Call.getArgExpr(idx); @@ -69,11 +69,12 @@ void AttrNonNullChecker::checkPreCall(const CallEvent &Call, if (!UT || !UT->getDecl()->hasAttr<TransparentUnionAttr>()) continue; - if (nonloc::CompoundVal *CSV = dyn_cast<nonloc::CompoundVal>(DV)) { + if (llvm::Optional<nonloc::CompoundVal> CSV = + DV->getAs<nonloc::CompoundVal>()) { nonloc::CompoundVal::iterator CSV_I = CSV->begin(); assert(CSV_I != CSV->end()); V = *CSV_I; - DV = dyn_cast<DefinedSVal>(&V); + DV = V.getAs<DefinedSVal>(); assert(++CSV_I == CSV->end()); if (!DV) continue; |