]> granicus.if.org Git - clang/commitdiff
Adding support for ObjC methods which have c-style
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 9 Jan 2009 00:38:19 +0000 (00:38 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 9 Jan 2009 00:38:19 +0000 (00:38 +0000)
parameter list. This is work in progress.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61964 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/Action.h
lib/Parse/ParseObjc.cpp
lib/Sema/Sema.h
lib/Sema/SemaDeclObjC.cpp

index 4c524f48d2df66cfc83cbdbaac40e9d472417abc..257d62f46be64968c0d8501941e7c9582c6279c1 100644 (file)
@@ -1133,6 +1133,7 @@ public:
     ObjCDeclSpec *ArgQT,       // for arguments' in inout etc.
     TypeTy **ArgTypes,         // non-zero when Sel.getNumArgs() > 0
     IdentifierInfo **ArgNames, // non-zero when Sel.getNumArgs() > 0
+    llvm::SmallVectorImpl<Declarator> &Cdecls, // c-style args
     AttributeList *AttrList,   // optional
     // tok::objc_not_keyword, tok::objc_optional, tok::objc_required    
     tok::ObjCKeywordKind impKind,
index cc13a5e0ae18dc609c18f94d57048d1b6c047fea..f52ecfb7fb127a7b19b86b728654398ed8a01076 100644 (file)
@@ -684,6 +684,7 @@ Parser::DeclTy *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
     return 0;
   }
   
+  llvm::SmallVector<Declarator, 8> CargNames;
   if (Tok.isNot(tok::colon)) {
     // If attributes exist after the method, parse them.
     AttributeList *MethodAttrs = 0;
@@ -693,7 +694,8 @@ Parser::DeclTy *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
     Selector Sel = PP.getSelectorTable().getNullarySelector(SelIdent);
     return Actions.ActOnMethodDeclaration(mLoc, Tok.getLocation(),
                                           mType, IDecl, DSRet, ReturnType, Sel,
-                                          0, 0, 0, MethodAttrs, MethodImplKind);
+                                          0, 0, 0, CargNames, 
+                                          MethodAttrs, MethodImplKind);
   }
 
   llvm::SmallVector<IdentifierInfo *, 12> KeyIdents;
@@ -748,13 +750,12 @@ Parser::DeclTy *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
       ConsumeToken();
       break;
     }
-    // FIXME: implement this...
-    // Parse the c-style argument declaration-specifier.
     DeclSpec DS;
     ParseDeclarationSpecifiers(DS);
     // Parse the declarator. 
     Declarator ParmDecl(DS, Declarator::PrototypeContext);
     ParseDeclarator(ParmDecl);
+    CargNames.push_back(ParmDecl);
   }
   
   // FIXME: Add support for optional parmameter list...
@@ -768,7 +769,8 @@ Parser::DeclTy *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
   return Actions.ActOnMethodDeclaration(mLoc, Tok.getLocation(),
                                         mType, IDecl, DSRet, ReturnType, Sel, 
                                         &ArgTypeQuals[0], &KeyTypes[0], 
-                                        &ArgNames[0], MethodAttrs, 
+                                        &ArgNames[0], CargNames, 
+                                        MethodAttrs,
                                         MethodImplKind, isVariadic);
 }
 
index 61be6445d1294cd718431491c3323d158d6478bf..bd7e0364a7a7f3aa64b9a142c36f1ac57265eff5 100644 (file)
@@ -1208,6 +1208,7 @@ public:
     // optional arguments. The number of types/arguments is obtained
     // from the Sel.getNumArgs().
     ObjCDeclSpec *ArgQT, TypeTy **ArgTypes, IdentifierInfo **ArgNames,
+    llvm::SmallVectorImpl<Declarator> &Cdecls,
     AttributeList *AttrList, tok::ObjCKeywordKind MethodImplKind,
     bool isVariadic = false);
 
index 7623c08e152c8e8af65d3985d140856d167d9a8d..3dfcb3a801244e6fa7933ca501db7bf5459274c8 100644 (file)
@@ -1272,6 +1272,7 @@ Sema::DeclTy *Sema::ActOnMethodDeclaration(
     // optional arguments. The number of types/arguments is obtained
     // from the Sel.getNumArgs().
     ObjCDeclSpec *ArgQT, TypeTy **ArgTypes, IdentifierInfo **ArgNames,
+    llvm::SmallVectorImpl<Declarator> &Cdecls,
     AttributeList *AttrList, tok::ObjCKeywordKind MethodDeclKind,
     bool isVariadic) {
   Decl *ClassDecl = static_cast<Decl*>(classDecl);