[cfe-commits] r42073 - in /cfe/trunk: Parse/ParseObjc.cpp Sema/Sema.h Sema/SemaDecl.cpp include/clang/Parse/Action.h include/clang/Parse/Parser.h

Fariborz Jahanian fjahanian at apple.com
Mon Sep 17 17:25:24 PDT 2007


Author: fjahanian
Date: Mon Sep 17 19:25:23 2007
New Revision: 42073

URL: http://llvm.org/viewvc/llvm-project?rev=42073&view=rev
Log:
Uses more description name for method implementation kind argument.
Moves such argument as the last argument and uses defaul value.

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

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

==============================================================================
--- cfe/trunk/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/Parse/ParseObjc.cpp Mon Sep 17 19:25:23 2007
@@ -216,7 +216,7 @@
 void Parser::ParseObjCInterfaceDeclList(DeclTy *interfaceDecl,
 					tok::ObjCKeywordKind contextKey) {
   llvm::SmallVector<DeclTy*, 32>  allMethods;
-  tok::ObjCKeywordKind pi = tok::objc_not_keyword;
+  tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword;
   while (1) {
     if (Tok.getKind() == tok::at) {
       SourceLocation AtLoc = ConsumeToken(); // the "@"
@@ -226,12 +226,12 @@
         break;
       } else if (ocKind == tok::objc_required) { // protocols only
         ConsumeToken();
-	pi = ocKind;
+	MethodImplKind = ocKind;
 	if (contextKey != tok::objc_protocol)
 	  Diag(AtLoc, diag::err_objc_protocol_required);
       } else if (ocKind == tok::objc_optional) { // protocols only
         ConsumeToken();
-	pi = ocKind;
+	MethodImplKind = ocKind;
 	if (contextKey != tok::objc_protocol)
 	  Diag(AtLoc, diag::err_objc_protocol_optional);
       } else if (ocKind == tok::objc_property) {
@@ -243,7 +243,7 @@
       }
     }
     if (Tok.getKind() == tok::minus || Tok.getKind() == tok::plus) {
-      DeclTy *methodPrototype = ParseObjCMethodPrototype(interfaceDecl, pi);
+      DeclTy *methodPrototype = ParseObjCMethodPrototype(interfaceDecl, MethodImplKind);
       allMethods.push_back(methodPrototype);
       // Consume the ';' here, since ParseObjCMethodPrototype() is re-used for
       // method definitions.
@@ -367,15 +367,15 @@
 ///   objc-method-attributes:         [OBJC2]
 ///     __attribute__((deprecated))
 ///
-Parser::DeclTy *Parser::ParseObjCMethodPrototype(DeclTy *IDecl,
-                          tok::ObjCKeywordKind& pi) {
+Parser::DeclTy *Parser::ParseObjCMethodPrototype(DeclTy *IDecl, 
+			  tok::ObjCKeywordKind MethodImplKind) {
   assert((Tok.getKind() == tok::minus || Tok.getKind() == tok::plus) && 
          "expected +/-");
 
   tok::TokenKind methodType = Tok.getKind();  
   SourceLocation methodLoc = ConsumeToken();
   
-  DeclTy *MDecl = ParseObjCMethodDecl(pi, methodType, methodLoc);
+  DeclTy *MDecl = ParseObjCMethodDecl(methodType, methodLoc, MethodImplKind);
   // Since this rule is used for both method declarations and definitions,
   // the caller is (optionally) responsible for consuming the ';'.
   return MDecl;
@@ -484,8 +484,8 @@
 ///   objc-keyword-attributes:         [OBJC2]
 ///     __attribute__((unused))
 ///
-Parser::DeclTy *Parser::ParseObjCMethodDecl(tok::ObjCKeywordKind& pi, 
-			  tok::TokenKind mType, SourceLocation mLoc) {
+Parser::DeclTy *Parser::ParseObjCMethodDecl(tok::TokenKind mType, SourceLocation mLoc,
+					    tok::ObjCKeywordKind MethodImplKind) {
 
   TypeTy *ReturnType = 0;
   AttributeList *methodAttrs = 0;
@@ -551,10 +551,10 @@
     // If attributes exist after the method, parse them.
     if (getLang().ObjC2 && Tok.getKind() == tok::kw___attribute) 
       methodAttrs = ParseAttributes();
-    return Actions.ObjcBuildMethodDeclaration(pi, mLoc, mType, 
+    return Actions.ObjcBuildMethodDeclaration(mLoc, mType, 
                                               ReturnType, 
                                               &KeyInfo[0], KeyInfo.size(), 
-					      methodAttrs);
+					      methodAttrs, MethodImplKind);
   } else if (!selIdent) {
     Diag(Tok, diag::err_expected_ident); // missing selector name.
   }
@@ -562,9 +562,9 @@
   if (getLang().ObjC2 && Tok.getKind() == tok::kw___attribute) 
     methodAttrs = ParseAttributes();
 
-  return Actions.ObjcBuildMethodDeclaration(pi,
-                                            mLoc, mType, ReturnType, 
-                                            selIdent, methodAttrs);
+  return Actions.ObjcBuildMethodDeclaration(mLoc, mType, ReturnType, 
+                                            selIdent, methodAttrs,
+					    MethodImplKind);
 }
 
 ///   objc-protocol-refs:
@@ -917,8 +917,7 @@
   assert(Tok.getKind() == tok::minus &&
          "ParseObjCInstanceMethodDefinition(): Expected '-'");
   // FIXME: @optional/@protocol??
-  tok::ObjCKeywordKind pi = tok::objc_not_keyword;
-  ParseObjCMethodPrototype(ObjcImpDecl, pi);
+  ParseObjCMethodPrototype(ObjcImpDecl);
   // parse optional ';'
   if (Tok.getKind() == tok::semi)
     ConsumeToken();
@@ -937,8 +936,7 @@
   assert(Tok.getKind() == tok::plus &&
          "ParseObjCClassMethodDefinition(): Expected '+'");
   // FIXME: @optional/@protocol??
-  tok::ObjCKeywordKind pi = tok::objc_not_keyword;
-  ParseObjCMethodPrototype(ObjcImpDecl, pi);
+  ParseObjCMethodPrototype(ObjcImpDecl);
   // parse optional ';'
   if (Tok.getKind() == tok::semi)
     ConsumeToken();

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

==============================================================================
--- cfe/trunk/Sema/Sema.h (original)
+++ cfe/trunk/Sema/Sema.h Mon Sep 17 19:25:23 2007
@@ -368,15 +368,15 @@
 
   virtual void ObjcAddMethodsToClass(DeclTy *ClassDecl, 
 				     DeclTy **allMethods, unsigned allNum);
-  virtual DeclTy *ObjcBuildMethodDeclaration(tok::ObjCKeywordKind& pi, 
-		    SourceLocation MethodLoc, 
+  virtual DeclTy *ObjcBuildMethodDeclaration(SourceLocation MethodLoc, 
 	            tok::TokenKind MethodType, TypeTy *ReturnType,
      		    ObjcKeywordDecl *Keywords, unsigned NumKeywords, 
-     		    AttributeList *AttrList);
-  virtual DeclTy *ObjcBuildMethodDeclaration(tok::ObjCKeywordKind& pi, 
-		    SourceLocation MethodLoc, 
+     		    AttributeList *AttrList,
+		    tok::ObjCKeywordKind MethodImplKind);
+  virtual DeclTy *ObjcBuildMethodDeclaration(SourceLocation MethodLoc, 
  	     	    tok::TokenKind MethodType, TypeTy *ReturnType,
-     		    IdentifierInfo *SelectorName, AttributeList *AttrList);
+     		    IdentifierInfo *SelectorName, AttributeList *AttrList,
+		    tok::ObjCKeywordKind MethodImplKind);
                     
   // This actions handles keyword message to classes.
   virtual ExprResult ActOnKeywordMessage(IdentifierInfo *receivingClassName, 

Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=42073&r1=42072&r2=42073&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Mon Sep 17 19:25:23 2007
@@ -1264,11 +1264,11 @@
   return;
 }
 
-Sema::DeclTy *Sema::ObjcBuildMethodDeclaration(tok::ObjCKeywordKind& pi,
-		      SourceLocation MethodLoc, 
+Sema::DeclTy *Sema::ObjcBuildMethodDeclaration(SourceLocation MethodLoc, 
                       tok::TokenKind MethodType, TypeTy *ReturnType,
                       ObjcKeywordDecl *Keywords, unsigned NumKeywords,
-                      AttributeList *AttrList) {
+                      AttributeList *AttrList,
+		      tok::ObjCKeywordKind MethodDeclKind) {
   assert(NumKeywords && "Selector must be specified");
 
   // Derive the selector name from the keyword declarations.
@@ -1306,17 +1306,17 @@
 				      SelName, resultDeclType,
 		      		      0, -1, AttrList, MethodType == tok::minus);
   ObjcMethod->setMethodParams(&Params[0], NumKeywords);
-  if (pi == tok::objc_optional)
+  if (MethodDeclKind == tok::objc_optional)
       ObjcMethod->setDeclImplementation(ObjcMethodDecl::Optional);
   else
        ObjcMethod->setDeclImplementation(ObjcMethodDecl::Required);
   return ObjcMethod;
 }
 
-Sema::DeclTy *Sema::ObjcBuildMethodDeclaration(tok::ObjCKeywordKind& pi,
-		      SourceLocation MethodLoc,  
+Sema::DeclTy *Sema::ObjcBuildMethodDeclaration(SourceLocation MethodLoc,  
                       tok::TokenKind MethodType, TypeTy *ReturnType,
-                      IdentifierInfo *SelectorName, AttributeList *AttrList) {
+                      IdentifierInfo *SelectorName, AttributeList *AttrList,
+		      tok::ObjCKeywordKind MethodDeclKind) {
   const char *methodName = SelectorName->getName();
   SelectorInfo &SelName = Context.getSelectorInfo(methodName, 
                                                   methodName+strlen(methodName));
@@ -1324,7 +1324,7 @@
   ObjcMethodDecl* ObjcMethod = new ObjcMethodDecl(MethodLoc, 
 			             SelName, resultDeclType, 0, -1,
                                      AttrList, MethodType == tok::minus);
-  if (pi == tok::objc_optional)
+  if (MethodDeclKind == tok::objc_optional)
       ObjcMethod->setDeclImplementation(ObjcMethodDecl::Optional);
   else
        ObjcMethod->setDeclImplementation(ObjcMethodDecl::Required);

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

==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Mon Sep 17 19:25:23 2007
@@ -453,15 +453,17 @@
                     IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs) {
     return 0;
   }
-  virtual DeclTy *ObjcBuildMethodDeclaration(tok::ObjCKeywordKind& pi, 
-    SourceLocation MethodLoc, tok::TokenKind MethodType, TypeTy *ReturnType,
+  virtual DeclTy *ObjcBuildMethodDeclaration(SourceLocation MethodLoc, 
+    tok::TokenKind MethodType, TypeTy *ReturnType,
     ObjcKeywordDecl *Keywords, unsigned NumKeywords, 
-    AttributeList *AttrList) {
+    AttributeList *AttrList,
+    tok::ObjCKeywordKind MethodImplKind) {
     return 0;
   }
-  virtual DeclTy *ObjcBuildMethodDeclaration(tok::ObjCKeywordKind& pi, 
-    SourceLocation MethodLoc, tok::TokenKind MethodType, TypeTy *ReturnType,
-    IdentifierInfo *SelectorName, AttributeList *AttrList) {
+  virtual DeclTy *ObjcBuildMethodDeclaration(SourceLocation MethodLoc, 
+    tok::TokenKind MethodType, TypeTy *ReturnType,
+    IdentifierInfo *SelectorName, AttributeList *AttrList,
+    tok::ObjCKeywordKind MethodImplKind) {
     return 0;
   }
   // This actions handles keyword message to classes.

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

==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Mon Sep 17 19:25:23 2007
@@ -290,10 +290,9 @@
   TypeTy *ParseObjCTypeName();
   void ParseObjCMethodRequirement();
   DeclTy *ParseObjCMethodPrototype(DeclTy *classOrCat,
-				   tok::ObjCKeywordKind& pi);
-  DeclTy *ParseObjCMethodDecl(tok::ObjCKeywordKind& pi,
-			      tok::TokenKind mType, 
-			      SourceLocation mLoc);
+   	    tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword);
+  DeclTy *ParseObjCMethodDecl(tok::TokenKind mType, SourceLocation mLoc,
+            tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword);
   void ParseObjCPropertyAttribute(DeclTy *interfaceDecl);
   void ParseObjCPropertyDecl(DeclTy *interfaceDecl);
   





More information about the cfe-commits mailing list