[cfe-commits] r47901 - /cfe/trunk/Analysis/GRExprEngine.cpp
Ted Kremenek
kremenek at apple.com
Tue Mar 4 12:40:12 PST 2008
Author: kremenek
Date: Tue Mar 4 14:40:11 2008
New Revision: 47901
URL: http://llvm.org/viewvc/llvm-project?rev=47901&view=rev
Log:
For the transfer function of DeclStmt, for now initialize the values of
structs (local variables) to Unknown instead of Undefined. (added FIXME to initialize *members* of struct to undefined)
Modified:
cfe/trunk/Analysis/GRExprEngine.cpp
Modified: cfe/trunk/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRExprEngine.cpp?rev=47901&r1=47900&r2=47901&view=diff
==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Tue Mar 4 14:40:11 2008
@@ -622,10 +622,10 @@
//
// FIXME: static variables may have an initializer, but the second
// time a function is called those values may not be current.
+
+ QualType T = VD->getType();
if ( VD->getStorageClass() == VarDecl::Static) {
-
- QualType T = VD->getType();
// C99: 6.7.8 Initialization
// If an object that has static storage duration is not initialized
@@ -634,6 +634,8 @@
// âif it has arithmetic type, it is initialized to (positive or
// unsigned) zero;
+ // FIXME: Handle structs. Now we treat their values as unknown.
+
if (T->isPointerType()) {
St = SetRVal(St, lval::DeclVal(VD),
@@ -645,18 +647,21 @@
nonlval::ConcreteInt(ValMgr.getValue(0, T)));
}
- // FIXME: Handle structs. Now we treat their values as unknown.
+
}
- else
- St = SetRVal(St, lval::DeclVal(VD),
- Ex ? GetRVal(St, Ex) : UndefinedVal());
+ else {
+
+ // FIXME: Handle structs. Now we treat them as unknown. What
+ // we need to do is treat their members as unknown.
+ if (T->isPointerType() || T->isIntegerType())
+ St = SetRVal(St, lval::DeclVal(VD),
+ Ex ? GetRVal(St, Ex) : UndefinedVal());
+ }
}
}
Nodify(Dst, DS, Pred, St);
-
- if (Dst.empty()) { Dst.Add(Pred); }
}
More information about the cfe-commits
mailing list