diff options
| author | Ted Kremenek <kremenek@apple.com> | 2007-11-24 20:07:36 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2007-11-24 20:07:36 +0000 |
| commit | 2e04d73d8353fe0103647668445432aaccb21c62 (patch) | |
| tree | 232e2bc1970585369a2b309b1b44a7c016753af4 /clang/Analysis/UninitializedValues.cpp | |
| parent | 33407b333871f7ac3b4d9aa5a98c6af9a43865c6 (diff) | |
| download | bcm5719-llvm-2e04d73d8353fe0103647668445432aaccb21c62.tar.gz bcm5719-llvm-2e04d73d8353fe0103647668445432aaccb21c62.zip | |
Fixed bogus culling of uninitialized-values "taint" propagation during assignments.
We accidentally were throttling the propagation of uninitialized state across
assignments (e.g. x = y). Thanks to Anders Carlsson for spotting this problem.
Added test cases to test suite to provide regression testing for the
uninitialized values analysis.
llvm-svn: 44306
Diffstat (limited to 'clang/Analysis/UninitializedValues.cpp')
| -rw-r--r-- | clang/Analysis/UninitializedValues.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/clang/Analysis/UninitializedValues.cpp b/clang/Analysis/UninitializedValues.cpp index 0a496595f63..8a27b71b8fd 100644 --- a/clang/Analysis/UninitializedValues.cpp +++ b/clang/Analysis/UninitializedValues.cpp @@ -101,6 +101,8 @@ BlockVarDecl* TransferFuncs::FindBlockVarDecl(Stmt *S) { else if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(S)) { if (BlockVarDecl* VD = dyn_cast<BlockVarDecl>(DR->getDecl())) return VD; + else + return NULL; } else return NULL; } @@ -108,16 +110,10 @@ BlockVarDecl* TransferFuncs::FindBlockVarDecl(Stmt *S) { bool TransferFuncs::VisitBinaryOperator(BinaryOperator* B) { if (BlockVarDecl* VD = FindBlockVarDecl(B->getLHS())) if (B->isAssignmentOp()) { - if (AD.FullUninitTaint) { - if (B->getOpcode() == BinaryOperator::Assign) - return V(VD,AD) = Visit(B->getRHS()); - else // Handle +=, -=, *=, etc. We do want '&', not '&&'. - return V(VD,AD) = Visit(B->getLHS()) & Visit(B->getRHS()); - } - else { - Visit(B->getLHS()); Visit(B->getRHS()); - return Initialized; - } + if (B->getOpcode() == BinaryOperator::Assign) + return V(VD,AD) = Visit(B->getRHS()); + else // Handle +=, -=, *=, etc. We do want '&', not '&&'. + return V(VD,AD) = Visit(B->getLHS()) & Visit(B->getRHS()); } return VisitStmt(B); |

