[cfe-commits] r119567 - in /cfe/trunk: include/clang/Checker/PathSensitive/GRExprEngine.h lib/Checker/GRCXXExprEngine.cpp

Marcin Swiderski marcin.sfider at gmail.com
Wed Nov 17 13:27:36 PST 2010


Author: sfider
Date: Wed Nov 17 15:27:36 2010
New Revision: 119567

URL: http://llvm.org/viewvc/llvm-project?rev=119567&view=rev
Log:
In EvalArguments allow for evaluation of first argument always as a lvalue. Will be used for CXXOperatorCallExpr that represents method call.

Modified:
    cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h
    cfe/trunk/lib/Checker/GRCXXExprEngine.cpp

Modified: cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h?rev=119567&r1=119566&r2=119567&view=diff
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h Wed Nov 17 15:27:36 2010
@@ -451,7 +451,8 @@
   /// 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)

Modified: cfe/trunk/lib/Checker/GRCXXExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRCXXExprEngine.cpp?rev=119567&r1=119566&r2=119567&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRCXXExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRCXXExprEngine.cpp Wed Nov 17 15:27:36 2010
@@ -30,7 +30,8 @@
 
 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 @@
 
     // 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);





More information about the cfe-commits mailing list