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 | f91a5b008d1a63630ae483247204c2651e512fa1 (patch) | |
tree | d42b3e32a04c3addc59fdee74e93c0b0b96f216f /lib/Analysis/CFG.cpp | |
parent | bea2753da897ede723e70bcd17023d050b0603d0 (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137006 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFG.cpp')
-rw-r--r-- | lib/Analysis/CFG.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index be6ffee668..1edb328d01 100644 --- a/lib/Analysis/CFG.cpp +++ b/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; } |