summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-04-05 05:18:05 +0000
committerTed Kremenek <kremenek@apple.com>2012-04-05 05:18:05 +0000
commit00fa5968cbd2f7709da707f3a31c53e3f6c34537 (patch)
tree8a1bd6b85954447bc94a0a522f3d1dac9c4aaea7 /clang/lib/StaticAnalyzer/Checkers
parentef909265e8a4fb32405fe8fe5eb1b29c3d2bae1c (diff)
downloadbcm5719-llvm-00fa5968cbd2f7709da707f3a31c53e3f6c34537.tar.gz
bcm5719-llvm-00fa5968cbd2f7709da707f3a31c53e3f6c34537.zip
Teach ObjCContainersChecker that the array passed to CFArrayGetValueAtIndex might not be a symbolic value.
llvm-svn: 154083
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
index 69e8fbb7ab6..207d65ad8fb 100644
--- a/clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
@@ -40,7 +40,6 @@ class ObjCContainersChecker : public Checker< check::PreStmt<CallExpr>,
inline SymbolRef getArraySym(const Expr *E, CheckerContext &C) const {
SVal ArrayRef = C.getState()->getSVal(E, C.getLocationContext());
SymbolRef ArraySym = ArrayRef.getAsSymbol();
- assert(ArraySym);
return ArraySym;
}
@@ -120,8 +119,12 @@ void ObjCContainersChecker::checkPreStmt(const CallExpr *CE,
// Retrieve the size.
// Find out if we saw this array symbol before and have information about it.
const Expr *ArrayExpr = CE->getArg(0);
- const DefinedSVal *Size =
- State->get<ArraySizeMap>(getArraySym(ArrayExpr, C));
+ SymbolRef ArraySym = getArraySym(ArrayExpr, C);
+ if (!ArraySym)
+ return;
+
+ const DefinedSVal *Size = State->get<ArraySizeMap>(ArraySym);
+
if (!Size)
return;
OpenPOWER on IntegriCloud