]> granicus.if.org Git - clang/commitdiff
Added initial transfer function support for ObjCMessageExpr.
authorTed Kremenek <kremenek@apple.com>
Tue, 25 Mar 2008 00:34:37 +0000 (00:34 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 25 Mar 2008 00:34:37 +0000 (00:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48757 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/GRExprEngine.h
lib/Analysis/GRExprEngine.cpp

index 8a21b02f641b7297e080aa0f723a1ee65d21e585..b15d3baf5662f261e29bdbb332c508ccbba26cc4 100644 (file)
@@ -388,6 +388,14 @@ protected:
                  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);  
   
index 254b8a3771cea670c323b6c55f1db81f22a48160..c143bd5dd3c99fd8c053d72b62e0719effb7cb54 100644 (file)
@@ -1082,6 +1082,42 @@ void GRExprEngine::VisitAsmStmtHelperInputs(AsmStmt* A,
 }
 
 
+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 @@ void GRExprEngine::Visit(Stmt* S, NodeTy* Pred, NodeSet& Dst) {
       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);