diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-08-06 00:30:00 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-08-06 00:30:00 +0000 |
commit | 84a1ca52807a4fd79dd1b43aa3700514638b0c65 (patch) | |
tree | 645e550f65d86d284dc1b6208429596c8fba4cd6 /clang/lib/Analysis/CFG.cpp | |
parent | c91ca30b4ce749ab3580bca9b10f463737932c46 (diff) | |
download | bcm5719-llvm-84a1ca52807a4fd79dd1b43aa3700514638b0c65.tar.gz bcm5719-llvm-84a1ca52807a4fd79dd1b43aa3700514638b0c65.zip |
[analyzer] Simplify logic for ExprEngine::VisitUnaryExprOrTypeTraitExpr to avoid recursion to subexpression.
This exposed bugs in the live variables analysis, and a latent analyzer bug in the SymbolReaper.
llvm-svn: 137006
Diffstat (limited to 'clang/lib/Analysis/CFG.cpp')
-rw-r--r-- | clang/lib/Analysis/CFG.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index be6ffee668d..1edb328d013 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -2204,6 +2204,15 @@ CFGBlock *CFGBuilder::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E, VA != 0; VA = FindVA(VA->getElementType().getTypePtr())) lastBlock = addStmt(VA->getSizeExpr()); } + else { + // For sizeof(x), where 'x' is a VLA, we should include the computation + // of the lvalue of 'x'. + Expr *subEx = E->getArgumentExpr(); + if (subEx->getType()->isVariableArrayType()) { + assert(subEx->isLValue()); + lastBlock = addStmt(subEx); + } + } return lastBlock; } |