[cfe-commits] r48757 - in /cfe/trunk: include/clang/Analysis/PathSensitive/GRExprEngine.h lib/Analysis/GRExprEngine.cpp

Ted Kremenek kremenek at apple.com
Mon Mar 24 17:34:37 PDT 2008


Author: kremenek
Date: Mon Mar 24 19:34:37 2008
New Revision: 48757

URL: http://llvm.org/viewvc/llvm-project?rev=48757&view=rev
Log:
Added initial transfer function support for ObjCMessageExpr.

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

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h?rev=48757&r1=48756&r2=48757&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h Mon Mar 24 19:34:37 2008
@@ -388,6 +388,14 @@
                  CallExpr::arg_iterator AI, CallExpr::arg_iterator AE,
                  NodeSet& Dst);
   
+  /// VisitObjCMessageExpr - Transfer function for ObjC message expressions.
+  void VisitObjCMessageExpr(ObjCMessageExpr* ME, NodeTy* Pred, NodeSet& Dst);
+  
+  void VisitObjCMessageExprHelper(ObjCMessageExpr* ME,
+                                  ObjCMessageExpr::arg_iterator I,
+                                  ObjCMessageExpr::arg_iterator E,
+                                  NodeTy* Pred, NodeSet& Dst);
+  
   /// VisitCast - Transfer function logic for all casts (implicit and explicit).
   void VisitCast(Expr* CastE, Expr* Ex, NodeTy* Pred, NodeSet& Dst);  
   

Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=48757&r1=48756&r2=48757&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Mon Mar 24 19:34:37 2008
@@ -1082,6 +1082,42 @@
 }
 
 
+void GRExprEngine::VisitObjCMessageExpr(ObjCMessageExpr* ME, NodeTy* Pred,
+                                        NodeSet& Dst){
+  VisitObjCMessageExprHelper(ME, ME->arg_begin(), ME->arg_end(), Pred, Dst);
+}  
+
+void GRExprEngine::VisitObjCMessageExprHelper(ObjCMessageExpr* ME,
+                                              ObjCMessageExpr::arg_iterator I,
+                                              ObjCMessageExpr::arg_iterator E,
+                                              NodeTy* Pred, NodeSet& Dst) {
+  if (I == E) {
+    
+    // Process the receiver.
+    
+    Expr* Receiver = ME->getReceiver();
+    NodeSet Tmp;
+    VisitLVal(Receiver, Pred, Tmp);
+        
+    // FIXME: More logic for the processing the method call. 
+    
+    for (NodeSet::iterator NI = Tmp.begin(), NE = Tmp.end(); NI != NE; ++NI)
+      Dst.Add(*NI);
+
+    return;
+  }
+  
+  NodeSet Tmp;
+  Visit(*I, Pred, Tmp);
+  
+  ++I;
+  
+  for (NodeSet::iterator NI = Tmp.begin(), NE = Tmp.end(); NI != NE; ++NI)
+    VisitObjCMessageExprHelper(ME, I, E, *NI, Dst);
+}
+
+
+
 void GRExprEngine::VisitBinaryOperator(BinaryOperator* B,
                                        GRExprEngine::NodeTy* Pred,
                                        GRExprEngine::NodeSet& Dst) {
@@ -1481,6 +1517,11 @@
       VisitCast(C, C->getSubExpr(), Pred, Dst);
       break;
     }
+      
+    case Stmt::ObjCMessageExprClass: {
+      VisitObjCMessageExpr(cast<ObjCMessageExpr>(S), Pred, Dst);
+      break;
+    }
 
     case Stmt::ParenExprClass:
       Visit(cast<ParenExpr>(S)->getSubExpr(), Pred, Dst);





More information about the cfe-commits mailing list