]> granicus.if.org Git - clang/commitdiff
Add parsing support in an Objective-C method declaration for attributes between
authorTed Kremenek <kremenek@apple.com>
Thu, 30 Apr 2009 17:55:29 +0000 (17:55 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 30 Apr 2009 17:55:29 +0000 (17:55 +0000)
the return type and selector. Haven't hooked this up to Sema yet.

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

lib/Parse/ParseObjc.cpp
test/Analysis/retain-release.m

index b4f417a15de6e03fe99304170141c440dfaf27e8..fc243270604b030b723eecb1b149e85a53420967 100644 (file)
@@ -677,6 +677,12 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc,
   if (Tok.is(tok::l_paren))
     ReturnType = ParseObjCTypeName(DSRet);
   
+  // Parse attributes that can appear before the selector.
+  AttributeList *ReturnAttrs = 0;
+
+  if (getLang().ObjC2 && Tok.is(tok::kw___attribute)) 
+    ReturnAttrs = ParseAttributes();  
+  
   SourceLocation selLoc;
   IdentifierInfo *SelIdent = ParseObjCSelectorPiece(selLoc);
 
index 5413debd8182b2633ebea83ef4313b2fd45ba5e1..9cf7d9dc66b87ec5525a62d3d1b688505bb6cadd 100644 (file)
@@ -432,6 +432,11 @@ void rdar6704930(unsigned char *s, unsigned int length) {
 
 @interface TestOwnershipAttr : NSObject
 - (NSString*) returnsAnOwnedString __attribute__((objc_ownership_returns));
+
+// We have parsing support for the attribute before the selector, but no Sema
+// support yet.
+- (NSString*)  __attribute__((objc_ownership_returns)) returnsAnOwnedString2;
+
 - (void) myRetain:(id)__attribute__((objc_ownership_retain))obj;
 - (void) myCFRetain:(id)__attribute__((objc_ownership_cfretain))obj;
 - (void) myRelease:(id)__attribute__((objc_ownership_release))obj;