summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
diff options
context:
space:
mode:
authorGabor Horvath <xazax.hun@gmail.com>2017-03-13 12:48:26 +0000
committerGabor Horvath <xazax.hun@gmail.com>2017-03-13 12:48:26 +0000
commit60eec1ac1b26b45d4f59b14a421e691b48b11128 (patch)
treedae099999e4ab221b0471a44a99ccb0aa6e2646f /clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
parent345012dfa0d058a6037f94ec0f7ee2002b411bf2 (diff)
downloadbcm5719-llvm-60eec1ac1b26b45d4f59b14a421e691b48b11128.tar.gz
bcm5719-llvm-60eec1ac1b26b45d4f59b14a421e691b48b11128.zip
[analyzer] Fix a rare crash for valist check.
It looks like on some host-triples the result of a valist related expr can be a LazyCompoundVal. Handle that case in the check. Patch by Abramo Bagnara! llvm-svn: 297619
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
index 9515c67a4d2..d12ba625807 100644
--- a/clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
@@ -165,11 +165,8 @@ void ValistChecker::checkPreCall(const CallEvent &Call,
const MemRegion *ValistChecker::getVAListAsRegion(SVal SV, const Expr *E,
bool &IsSymbolic,
CheckerContext &C) const {
- // FIXME: on some platforms CallAndMessage checker finds some instances of
- // the uninitialized va_list usages. CallAndMessage checker is disabled in
- // the tests so they can verify platform independently those issues. As a
- // side effect, this check is required here.
- if (SV.isUnknownOrUndef())
+ const MemRegion *Reg = SV.getAsRegion();
+ if (!Reg)
return nullptr;
// TODO: In the future this should be abstracted away by the analyzer.
bool VaListModelledAsArray = false;
@@ -178,7 +175,6 @@ const MemRegion *ValistChecker::getVAListAsRegion(SVal SV, const Expr *E,
VaListModelledAsArray =
Ty->isPointerType() && Ty->getPointeeType()->isRecordType();
}
- const MemRegion *Reg = SV.getAsRegion();
if (const auto *DeclReg = Reg->getAs<DeclRegion>()) {
if (isa<ParmVarDecl>(DeclReg->getDecl()))
Reg = C.getState()->getSVal(SV.castAs<Loc>()).getAsRegion();
OpenPOWER on IntegriCloud