[cfe-commits] r42059 - in /cfe/trunk: Parse/ParseObjc.cpp Sema/Sema.h Sema/SemaExpr.cpp include/clang/Parse/Action.h

Steve Naroff snaroff at apple.com
Mon Sep 17 14:01:16 PDT 2007


Author: snaroff
Date: Mon Sep 17 16:01:15 2007
New Revision: 42059

URL: http://llvm.org/viewvc/llvm-project?rev=42059&view=rev
Log:

Finish defining Action API for message expressions.

Modified:
    cfe/trunk/Parse/ParseObjc.cpp
    cfe/trunk/Sema/Sema.h
    cfe/trunk/Sema/SemaExpr.cpp
    cfe/trunk/include/clang/Parse/Action.h

Modified: cfe/trunk/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/ParseObjc.cpp?rev=42059&r1=42058&r2=42059&view=diff

==============================================================================
--- cfe/trunk/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/Parse/ParseObjc.cpp Mon Sep 17 16:01:15 2007
@@ -1051,11 +1051,18 @@
   }
   ConsumeBracket(); // consume ']'
   
+  if (KeyInfo.size()) {
+    // We've just parsed a keyword message.
+    if (ReceiverName) 
+      return Actions.ActOnKeywordMessage(ReceiverName, 
+                                            &KeyInfo[0], KeyInfo.size());
+    return Actions.ActOnKeywordMessage(ReceiverExpr, 
+                                            &KeyInfo[0], KeyInfo.size());
+  }
+  // We've just parsed a unary message (a message with no arguments).
   if (ReceiverName) 
-    return Actions.ActOnMessageExpression(ReceiverName, 
-                                          &KeyInfo[0], KeyInfo.size());
-  return Actions.ActOnMessageExpression(ReceiverExpr, 
-                                          &KeyInfo[0], KeyInfo.size());
+    return Actions.ActOnUnaryMessage(ReceiverName, selIdent);
+  return Actions.ActOnUnaryMessage(ReceiverExpr, selIdent);
 }
 
 Parser::ExprResult Parser::ParseObjCStringLiteral() {

Modified: cfe/trunk/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/Sema.h?rev=42059&r1=42058&r2=42059&view=diff

==============================================================================
--- cfe/trunk/Sema/Sema.h (original)
+++ cfe/trunk/Sema/Sema.h Mon Sep 17 16:01:15 2007
@@ -371,6 +371,19 @@
   virtual DeclTy *ObjcBuildMethodDeclaration(SourceLocation MethodLoc, 
  	     	    tok::TokenKind MethodType, TypeTy *ReturnType,
      		    IdentifierInfo *SelectorName, AttributeList *AttrList);
+                    
+  // This actions handles keyword message to classes.
+  virtual ExprResult ActOnKeywordMessage(IdentifierInfo *receivingClassName, 
+    ObjcKeywordMessage *Keywords, unsigned NumKeywords);
+  // This action handles keyword messages to instances.
+  virtual ExprResult ActOnKeywordMessage(ExprTy *receiver, 
+    ObjcKeywordMessage *Keywords, unsigned NumKeywords);
+    
+  // This actions handles keyword message to classes.
+  virtual ExprResult ActOnUnaryMessage(IdentifierInfo *receivingClassName, 
+                                    IdentifierInfo *selName);
+  // This action handles keyword messages to instances.
+  virtual ExprResult ActOnUnaryMessage(ExprTy *receiver, IdentifierInfo *sName);
 private:
   // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts
   // functions and arrays to their respective pointers (C99 6.3.2.1). 

Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=42059&r1=42058&r2=42059&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Mon Sep 17 16:01:15 2007
@@ -1855,3 +1855,29 @@
   QualType t = Context.getPointerType(Context.CharTy);
   return new ObjCEncodeExpr(t, EncodedType, AtLoc, RParenLoc);
 }
+
+// This actions handles keyword message to classes.
+Sema::ExprResult Sema::ActOnKeywordMessage(IdentifierInfo *receivingClassName, 
+    ObjcKeywordMessage *Keywords, unsigned NumKeywords)
+{
+  return 0;
+}
+
+// This action handles keyword messages to instances.
+Sema::ExprResult Sema::ActOnKeywordMessage(ExprTy *receiver, 
+    ObjcKeywordMessage *Keywords, unsigned NumKeywords) {
+  return 0;
+}
+    
+// This actions handles keyword message to classes.
+Sema::ExprResult Sema::ActOnUnaryMessage(IdentifierInfo *receivingClassName, 
+                                         IdentifierInfo *selName) {
+  return 0;
+}
+
+// This action handles keyword messages to instances.
+Sema::ExprResult Sema::ActOnUnaryMessage(ExprTy *receiver, 
+                                         IdentifierInfo *selName) {
+  return 0;
+}
+

Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=42059&r1=42058&r2=42059&view=diff

==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Mon Sep 17 16:01:15 2007
@@ -460,15 +460,24 @@
     return 0;
   }
   // This actions handles keyword message to classes.
-  virtual DeclTy *ActOnMessageExpression(IdentifierInfo *receivingClassName, 
+  virtual ExprResult ActOnKeywordMessage(IdentifierInfo *receivingClassName, 
     ObjcKeywordMessage *Keywords, unsigned NumKeywords) {
     return 0;
   }
   // This action handles keyword messages to instances.
-  virtual DeclTy *ActOnMessageExpression(ExprTy *receiver, 
+  virtual ExprResult ActOnKeywordMessage(ExprTy *receiver, 
     ObjcKeywordMessage *Keywords, unsigned NumKeywords) {
     return 0;
   }
+  // This actions handles keyword message to classes.
+  virtual ExprResult ActOnUnaryMessage(IdentifierInfo *receivingClassName, 
+                                    IdentifierInfo *selName) {
+    return 0;
+  }
+  // This action handles keyword messages to instances.
+  virtual ExprResult ActOnUnaryMessage(ExprTy *receiver,IdentifierInfo *sName) {
+    return 0;
+  }
   virtual DeclTy *ObjcClassDeclaration(Scope *S, SourceLocation AtClassLoc,
                                        IdentifierInfo **IdentList,
                                        unsigned NumElts) {





More information about the cfe-commits mailing list