]> granicus.if.org Git - clang/commitdiff
Clear the return expr GDM after using it.
authorZhongxing Xu <xuzhongxing@gmail.com>
Tue, 23 Mar 2010 08:09:29 +0000 (08:09 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Tue, 23 Mar 2010 08:09:29 +0000 (08:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99268 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Checker/GRExprEngine.cpp

index 553f949d87c5c9ec0c3e109e25b28e1408ddfe5c..8ed57e70934c4288237893e463b74193b4745257 100644 (file)
@@ -1329,6 +1329,8 @@ void GRExprEngine::ProcessCallExit(GRCallExitNodeBuilder &B) {
   if (ReturnedExpr) {
     SVal RetVal = state->getSVal(ReturnedExpr);
     state = state->BindExpr(CE, RetVal);
+    // Clear the return expr GDM.
+    state = state->set<ReturnExpr>(0);
   }
 
   B.GenerateNode(state);
@@ -2909,7 +2911,8 @@ void GRExprEngine::VisitReturnStmt(ReturnStmt *RS, ExplodedNode *Pred,
                                    ExplodedNodeSet &Dst) {
   ExplodedNodeSet Src;
   if (Expr *RetE = RS->getRetValue()) {
-    // Record the returned expression in the state.
+    // Record the returned expression in the state. It will be used in
+    // ProcessCallExit to bind the return value to the call expr.
     {
       static int Tag = 0;
       SaveAndRestore<const void *> OldTag(Builder->Tag, &Tag);