[cfe-commits] r51925 - in /cfe/trunk: lib/AST/DeclObjC.cpp test/Sema/objc-property-8.m
Steve Naroff
snaroff at apple.com
Tue Jun 3 21:46:04 PDT 2008
Author: snaroff
Date: Tue Jun 3 23:46:04 2008
New Revision: 51925
URL: http://llvm.org/viewvc/llvm-project?rev=51925&view=rev
Log:
Make sure we look through categories when searching for a classes property.
Fixes <rdar://problem/5984338> clang on xcode: property implementation must have its declaration in interface 'PBXOpenQuicklyModule'
Added:
cfe/trunk/test/Sema/objc-property-8.m
Modified:
cfe/trunk/lib/AST/DeclObjC.cpp
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=51925&r1=51924&r2=51925&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Tue Jun 3 23:46:04 2008
@@ -150,6 +150,13 @@
if (property->getIdentifier() == PropertyId)
return property;
}
+ // Look through categories.
+ for (ObjCCategoryDecl *Category = getCategoryList();
+ Category; Category = Category->getNextClassCategory()) {
+ ObjCPropertyDecl *property = Category->FindPropertyDeclaration(PropertyId);
+ if (property)
+ return property;
+ }
if (getSuperClass())
return getSuperClass()->FindPropertyDeclaration(PropertyId);
return 0;
Added: cfe/trunk/test/Sema/objc-property-8.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/objc-property-8.m?rev=51925&view=auto
==============================================================================
--- cfe/trunk/test/Sema/objc-property-8.m (added)
+++ cfe/trunk/test/Sema/objc-property-8.m Tue Jun 3 23:46:04 2008
@@ -0,0 +1,74 @@
+// RUN: clang -fsyntax-only -verify %s
+typedef signed char BOOL;
+typedef unsigned int NSUInteger;
+typedef struct _NSZone NSZone;
+
+ at class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
+
+ at protocol NSObject - (BOOL)isEqual:(id)object; @end
+ at protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end
+ at protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; @end
+ at protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; @end
+
+ at interface NSObject <NSObject> {} @end
+
+typedef float CGFloat;
+
+typedef enum { NSMinXEdge = 0, NSMinYEdge = 1, NSMaxXEdge = 2, NSMaxYEdge = 3 } NSFastEnumerationState;
+
+ at protocol NSFastEnumeration
+- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len;
+ at end
+
+ at class NSString;
+
+ at interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration>
+- (NSUInteger)count;
+ at end
+
+extern NSString * const NSBundleDidLoadNotification;
+
+ at interface NSObject(NSKeyValueObserving)
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context;
+- (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath;
+ at end
+
+enum { NSCaseInsensitivePredicateOption = 0x01, NSDiacriticInsensitivePredicateOption = 0x02 };
+
+ at interface NSResponder : NSObject <NSCoding> {}
+ at end
+
+extern NSString * const NSFullScreenModeAllScreens;
+ at interface NSWindowController : NSResponder <NSCoding> {}
+ at end
+
+extern NSString *NSAlignmentBinding ;
+
+ at interface _XCOQQuery : NSObject {}
+ at end
+
+extern NSString *PBXWindowDidChangeFirstResponderNotification;
+
+ at interface PBXModule : NSWindowController {}
+ at end
+
+ at class _XCOQHelpTextBackgroundView;
+ at interface PBXOpenQuicklyModule : PBXModule
+{
+ at private
+ _XCOQQuery *_query;
+}
+ at end
+
+ at interface PBXOpenQuicklyModule ()
+ at property(readwrite, retain) _XCOQQuery *query;
+ at end
+
+ at implementation PBXOpenQuicklyModule
+ at synthesize query = _query;
+- (void) _clearQuery
+{
+ [self.query removeObserver: self forKeyPath: @"matches"]; // expected-error{{cannot find interface declaration for 'NSConstantString'}}
+}
+ at end
+
More information about the cfe-commits
mailing list