aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-04-30 17:55:29 +0000
committerTed Kremenek <kremenek@apple.com>2009-04-30 17:55:29 +0000
commit77755a57c9e85418626ac64c0d38975d5fa9aded (patch)
treefcd05f9dd5763f0977979d53db5291b33121c306
parent940ab971c580ca03da2e68ec92b9c0f7acfe6988 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70501 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/ParseObjc.cpp6
-rw-r--r--test/Analysis/retain-release.m5
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index b4f417a15d..fc24327060 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -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);
diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m
index 5413debd81..9cf7d9dc66 100644
--- a/test/Analysis/retain-release.m
+++ b/test/Analysis/retain-release.m
@@ -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;