[cfe-commits] r42449 - /cfe/trunk/Analysis/UninitializedValues.cpp
Ted Kremenek
kremenek at apple.com
Fri Sep 28 14:08:51 PDT 2007
Author: kremenek
Date: Fri Sep 28 16:08:51 2007
New Revision: 42449
URL: http://llvm.org/viewvc/llvm-project?rev=42449&view=rev
Log:
Fixed UninitializedValues to properly propagate uninitialized "taint"
in assignment operations of the form +=, -=, *=, etc.
Modified:
cfe/trunk/Analysis/UninitializedValues.cpp
Modified: cfe/trunk/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/UninitializedValues.cpp?rev=42449&r1=42448&r2=42449&view=diff
==============================================================================
--- cfe/trunk/Analysis/UninitializedValues.cpp (original)
+++ cfe/trunk/Analysis/UninitializedValues.cpp Fri Sep 28 16:08:51 2007
@@ -106,10 +106,20 @@
}
bool TransferFuncs::VisitBinaryOperator(BinaryOperator* B) {
- if (B->isAssignmentOp())
- if (BlockVarDecl* VD = FindBlockVarDecl(B->getLHS()))
- return V(VD,AD) = AD.FullUninitTaint ? Visit(B->getRHS()) : Initialized;
-
+ 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;
+ }
+ }
+
return VisitStmt(B);
}
More information about the cfe-commits
mailing list