Add parsing support in an Objective-C method declaration for attributes between

the return type and selector. Haven't hooked this up to Sema yet.

llvm-svn: 70501
This commit is contained in:
Ted Kremenek 2009-04-30 17:55:29 +00:00
parent a80dd1cae1
commit 8c06515f2b
2 changed files with 11 additions and 0 deletions

View 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);

View 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;