diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-08-23 20:30:50 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-08-23 20:30:50 +0000 |
commit | ee9848e20d2659f939fb6e773729c6a86e6ed1da (patch) | |
tree | 9450556c0201c0061b7da6dc3c44582f5a0b79d9 /clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp | |
parent | 43c322b5b2de0b89d2b282f5d98785b269a6e2b3 (diff) | |
download | bcm5719-llvm-ee9848e20d2659f939fb6e773729c6a86e6ed1da.tar.gz bcm5719-llvm-ee9848e20d2659f939fb6e773729c6a86e6ed1da.zip |
Fix regression in -Wuninitialized involving VLAs. It turns out that we were modeling sizeof(VLAs)
incorrectly in the CFG, and also the static analyzer. This patch regresses the analyzer a bit, but
that needs to be followed up with a better solution.
Fixes <rdar://problem/10008112>.
llvm-svn: 138372
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp index 3e3238cdef8..a4e640c0e98 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp @@ -503,30 +503,9 @@ VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *Ex, if (!T->isIncompleteType() && !T->isConstantSizeType()) { assert(T->isVariableArrayType() && "Unknown non-constant-sized type."); - // FIXME: Add support for VLA type arguments, not just VLA expressions. + // FIXME: Add support for VLA type arguments and VLA expressions. // When that happens, we should probably refactor VLASizeChecker's code. - if (Ex->isArgumentType()) { - Dst.Add(Pred); - return; - } - - // Get the size by getting the extent of the sub-expression. - // First, visit the sub-expression to find its region. - const Expr *Arg = Ex->getArgumentExpr(); - const ProgramState *state = Pred->getState(); - const MemRegion *MR = state->getSVal(Arg).getAsRegion(); - - // If the subexpression can't be resolved to a region, we don't know - // anything about its size. Just leave the state as is and continue. - if (!MR) { - Dst.Add(Pred); - return; - } - - // The result is the extent of the VLA. - SVal Extent = cast<SubRegion>(MR)->getExtent(svalBuilder); - MakeNode(Dst, Ex, Pred, state->BindExpr(Ex, Extent)); - + Dst.Add(Pred); return; } else if (T->getAs<ObjCObjectType>()) { |