[cfe-commits] r44982 - in /cfe/trunk/Analysis: LiveVariables.cpp UninitializedValues.cpp
Ted Kremenek
kremenek at apple.com
Wed Dec 12 20:47:16 PST 2007
Author: kremenek
Date: Wed Dec 12 22:47:15 2007
New Revision: 44982
URL: http://llvm.org/viewvc/llvm-project?rev=44982&view=rev
Log:
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)
Modified:
cfe/trunk/Analysis/LiveVariables.cpp
cfe/trunk/Analysis/UninitializedValues.cpp
Modified: cfe/trunk/Analysis/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/LiveVariables.cpp?rev=44982&r1=44981&r2=44982&view=diff
==============================================================================
--- cfe/trunk/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/Analysis/LiveVariables.cpp Wed Dec 12 22:47:15 2007
@@ -93,6 +93,7 @@
Stmt *S = U->getSubExpr();
switch (U->getOpcode()) {
+ case UnaryOperator::SizeOf: return;
case UnaryOperator::PostInc:
case UnaryOperator::PostDec:
case UnaryOperator::PreInc:
Modified: cfe/trunk/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/UninitializedValues.cpp?rev=44982&r1=44981&r2=44982&view=diff
==============================================================================
--- cfe/trunk/Analysis/UninitializedValues.cpp (original)
+++ cfe/trunk/Analysis/UninitializedValues.cpp Wed Dec 12 22:47:15 2007
@@ -136,9 +136,19 @@
}
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());
}
More information about the cfe-commits
mailing list