[cfe-commits] r47912 - in /cfe/trunk/Analysis: GRExprEngine.cpp GRSimpleVals.cpp
Ted Kremenek
kremenek at apple.com
Tue Mar 4 14:16:09 PST 2008
Author: kremenek
Date: Tue Mar 4 16:16:08 2008
New Revision: 47912
URL: http://llvm.org/viewvc/llvm-project?rev=47912&view=rev
Log:
Added preliminary transfer function support for references.
Modified:
cfe/trunk/Analysis/GRExprEngine.cpp
cfe/trunk/Analysis/GRSimpleVals.cpp
Modified: cfe/trunk/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRExprEngine.cpp?rev=47912&r1=47911&r2=47912&view=diff
==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Tue Mar 4 16:16:08 2008
@@ -598,10 +598,13 @@
void GRExprEngine::VisitCast(Expr* CastE, Expr* Ex, NodeTy* Pred, NodeSet& Dst){
NodeSet S1;
- Visit(Ex, Pred, S1);
-
QualType T = CastE->getType();
+ if (T->isReferenceType())
+ VisitLVal(Ex, Pred, S1);
+ else
+ Visit(Ex, Pred, S1);
+
// Check for redundant casts or casting to "void"
if (T->isVoidType() ||
Ex->getType() == T ||
@@ -616,7 +619,9 @@
for (NodeSet::iterator I1 = S1.begin(), E1 = S1.end(); I1 != E1; ++I1) {
NodeTy* N = *I1;
ValueState* St = N->getState();
- RVal V = GetRVal(St, Ex);
+
+ RVal V = T->isReferenceType() ? GetLVal(St, Ex) : GetRVal(St, Ex);
+
Nodify(Dst, CastE, N, SetRVal(St, CastE, EvalCast(V, CastE->getType())));
}
}
Modified: cfe/trunk/Analysis/GRSimpleVals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRSimpleVals.cpp?rev=47912&r1=47911&r2=47912&view=diff
==============================================================================
--- cfe/trunk/Analysis/GRSimpleVals.cpp (original)
+++ cfe/trunk/Analysis/GRSimpleVals.cpp Tue Mar 4 16:16:08 2008
@@ -172,7 +172,7 @@
RVal GRSimpleVals::EvalCast(ValueManager& ValMgr, LVal X, QualType T) {
- if (T->isPointerType())
+ if (T->isPointerType() || T->isReferenceType())
return X;
assert (T->isIntegerType());
More information about the cfe-commits
mailing list