[cfe-commits] r70501 - in /cfe/trunk: lib/Parse/ParseObjc.cpp test/Analysis/retain-release.m

Ted Kremenek kremenek at apple.com
Thu Apr 30 10:55:29 PDT 2009


Author: kremenek
Date: Thu Apr 30 12:55:29 2009
New Revision: 70501

URL: http://llvm.org/viewvc/llvm-project?rev=70501&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Parse/ParseObjc.cpp
    cfe/trunk/test/Analysis/retain-release.m

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

==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Thu Apr 30 12:55:29 2009
@@ -677,6 +677,12 @@
   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);
 

Modified: cfe/trunk/test/Analysis/retain-release.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release.m?rev=70501&r1=70500&r2=70501&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/retain-release.m (original)
+++ cfe/trunk/test/Analysis/retain-release.m Thu Apr 30 12:55:29 2009
@@ -432,6 +432,11 @@
 
 @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;





More information about the cfe-commits mailing list