Fixed bug in live-variable analysis and uninitialized-values analysis where

we incorrectly examine the expression within a sizeof() for use in computing
dataflow values.

This fixes: PR 1858 (http://llvm.org/bugs/show_bug.cgi?id=1858)

llvm-svn: 44982
This commit is contained in:
Ted Kremenek 2007-12-13 04:47:15 +00:00
parent 37c36ed79a
commit 78dcda6059
2 changed files with 14 additions and 3 deletions

View File

@ -93,6 +93,7 @@ void TransferFuncs::VisitUnaryOperator(UnaryOperator* U) {
Stmt *S = U->getSubExpr();
switch (U->getOpcode()) {
case UnaryOperator::SizeOf: return;
case UnaryOperator::PostInc:
case UnaryOperator::PostDec:
case UnaryOperator::PreInc:

View File

@ -136,9 +136,19 @@ bool TransferFuncs::VisitCallExpr(CallExpr* C) {
}
bool TransferFuncs::VisitUnaryOperator(UnaryOperator* U) {
if (U->getOpcode() == UnaryOperator::AddrOf)
if (BlockVarDecl* VD = FindBlockVarDecl(U->getSubExpr()))
return V(VD,AD) = Initialized;
switch (U->getOpcode()) {
case UnaryOperator::AddrOf:
if (BlockVarDecl* VD = FindBlockVarDecl(U->getSubExpr()))
return V(VD,AD) = Initialized;
break;
case UnaryOperator::SizeOf:
return Initialized;
default:
break;
}
return Visit(U->getSubExpr());
}