[cfe-commits] r47683 - /cfe/trunk/Analysis/GRExprEngine.cpp
Ted Kremenek
kremenek at apple.com
Wed Feb 27 11:21:34 PST 2008
Author: kremenek
Date: Wed Feb 27 13:21:33 2008
New Revision: 47683
URL: http://llvm.org/viewvc/llvm-project?rev=47683&view=rev
Log:
Small tweaks to the transfer function for DeclStmt: do not mark external global
variables as uninitialized, and only "initialize" static function variables.
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=47683&r1=47682&r2=47683&view=diff
==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Wed Feb 27 13:21:33 2008
@@ -592,12 +592,24 @@
if (VD->getType()->isArrayType())
continue;
- // FIXME: static variables have an initializer, but the second
- // time a function is called those values may not be current.
- const Expr* Ex = VD->getInit();
+ const Expr* Ex = VD->getInit();
- St = SetRVal(St, lval::DeclVal(VD),
- Ex ? GetRVal(St, Ex) : UninitializedVal());
+ if (!VD->hasGlobalStorage() || VD->getStorageClass() == VarDecl::Static) {
+
+ // In this context, Static => Local variable.
+
+ assert (!VD->getStorageClass() == VarDecl::Static ||
+ !isa<FileVarDecl>(VD));
+
+ // If there is no initializer, set the value of the
+ // variable to "Uninitialized".
+ //
+ // FIXME: static variables may have an initializer, but the second
+ // time a function is called those values may not be current.
+
+ St = SetRVal(St, lval::DeclVal(VD),
+ Ex ? GetRVal(St, Ex) : UninitializedVal());
+ }
}
Nodify(Dst, DS, Pred, St);
More information about the cfe-commits
mailing list