]> granicus.if.org Git - clang/commitdiff
In EvalArguments allow for evaluation of first argument always as a lvalue. Will...
authorMarcin Swiderski <marcin.sfider@gmail.com>
Wed, 17 Nov 2010 21:27:36 +0000 (21:27 +0000)
committerMarcin Swiderski <marcin.sfider@gmail.com>
Wed, 17 Nov 2010 21:27:36 +0000 (21:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119567 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Checker/PathSensitive/GRExprEngine.h
lib/Checker/GRCXXExprEngine.cpp

index f9082f421488f9f921669ac0e2e4294ff54da841..998eceffc3f8d7e583007b1bc3205aa69050342e 100644 (file)
@@ -451,7 +451,8 @@ public:
   /// Evaluate arguments with a work list algorithm.
   void EvalArguments(ConstExprIterator AI, ConstExprIterator AE,
                      const FunctionProtoType *FnType, 
-                     ExplodedNode *Pred, ExplodedNodeSet &Dst);
+                     ExplodedNode *Pred, ExplodedNodeSet &Dst,
+                     bool FstArgAsLValue = false);
 
   /// EvalEagerlyAssume - Given the nodes in 'Src', eagerly assume symbolic
   ///  expressions of the form 'x != 0' and generate new nodes (stored in Dst)
index 50f2cb51c01e9945f5d6603e853fdc3d18949317..4c996bb22ee53bf5f02ee1f46a57c9a91d08e177 100644 (file)
@@ -30,7 +30,8 @@ public:
 
 void GRExprEngine::EvalArguments(ConstExprIterator AI, ConstExprIterator AE,
                                  const FunctionProtoType *FnType, 
-                                 ExplodedNode *Pred, ExplodedNodeSet &Dst) {
+                                 ExplodedNode *Pred, ExplodedNodeSet &Dst,
+                                 bool FstArgAsLValue) {
 
 
   llvm::SmallVector<CallExprWLItem, 20> WorkList;
@@ -48,10 +49,15 @@ void GRExprEngine::EvalArguments(ConstExprIterator AI, ConstExprIterator AE,
 
     // Evaluate the argument.
     ExplodedNodeSet Tmp;
-    const unsigned ParamIdx = Item.I - AI;
-    const bool VisitAsLvalue = FnType && ParamIdx < FnType->getNumArgs() 
-      ? FnType->getArgType(ParamIdx)->isReferenceType()
-      : false;
+    bool VisitAsLvalue = FstArgAsLValue;
+    if (FstArgAsLValue) {
+      FstArgAsLValue = false;
+    } else {
+      const unsigned ParamIdx = Item.I - AI;
+      VisitAsLvalue = FnType && ParamIdx < FnType->getNumArgs() 
+        ? FnType->getArgType(ParamIdx)->isReferenceType()
+        : false;
+    }
 
     if (VisitAsLvalue)
       VisitLValue(*Item.I, Item.N, Tmp);