diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-03-04 22:16:08 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-03-04 22:16:08 +0000 |
commit | 65cfb7373de545ab23a105e9f7d97d100f0dcebd (patch) | |
tree | 4f5ae74606738a436bb65067dd10b1ece18d5de7 | |
parent | d753f3c62bfb85e5955b60eb77c3451548745fc1 (diff) |
Added preliminary transfer function support for references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47912 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Analysis/GRExprEngine.cpp | 11 | ||||
-rw-r--r-- | Analysis/GRSimpleVals.cpp | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/Analysis/GRExprEngine.cpp b/Analysis/GRExprEngine.cpp index e7f6f77859..a011e7b360 100644 --- a/Analysis/GRExprEngine.cpp +++ b/Analysis/GRExprEngine.cpp @@ -598,10 +598,13 @@ void GRExprEngine::VisitCall(CallExpr* CE, NodeTy* Pred, 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 @@ void GRExprEngine::VisitCast(Expr* CastE, Expr* Ex, NodeTy* Pred, NodeSet& Dst){ 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()))); } } diff --git a/Analysis/GRSimpleVals.cpp b/Analysis/GRSimpleVals.cpp index a28ff1cf59..fbaccba94f 100644 --- a/Analysis/GRSimpleVals.cpp +++ b/Analysis/GRSimpleVals.cpp @@ -172,7 +172,7 @@ RVal GRSimpleVals::EvalCast(ValueManager& ValMgr, NonLVal X, QualType T) { RVal GRSimpleVals::EvalCast(ValueManager& ValMgr, LVal X, QualType T) { - if (T->isPointerType()) + if (T->isPointerType() || T->isReferenceType()) return X; assert (T->isIntegerType()); |