summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjC
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-03-27 19:02:17 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-03-27 19:02:17 +0000
commit97752f7c957e8cb0f787b6cf4c8494b5292e015d (patch)
treeca5c2f61bae36374127662d771517f68d3f72d6c /clang/test/SemaObjC
parentdecc73d4bc207ecda2997e9e23770226103163ed (diff)
downloadbcm5719-llvm-97752f7c957e8cb0f787b6cf4c8494b5292e015d.tar.gz
bcm5719-llvm-97752f7c957e8cb0f787b6cf4c8494b5292e015d.zip
Improve diagnostics on incomplete implementation
of objc classes; including which methods need be implemented and where they come from. WIP. llvm-svn: 99724
Diffstat (limited to 'clang/test/SemaObjC')
-rw-r--r--clang/test/SemaObjC/category-1.m6
-rw-r--r--clang/test/SemaObjC/compare-qualified-id.m7
-rw-r--r--clang/test/SemaObjC/conditional-expr.m4
-rw-r--r--clang/test/SemaObjC/gcc-cast-ext.m6
-rw-r--r--clang/test/SemaObjC/method-arg-decay.m10
-rw-r--r--clang/test/SemaObjC/method-undef-category-warn-1.m18
-rw-r--r--clang/test/SemaObjC/method-undef-extension-warn-1.m10
-rw-r--r--clang/test/SemaObjC/method-undefined-warn-1.m16
-rw-r--r--clang/test/SemaObjC/undef-protocol-methods-1.m34
9 files changed, 48 insertions, 63 deletions
diff --git a/clang/test/SemaObjC/category-1.m b/clang/test/SemaObjC/category-1.m
index 24324f8500a..bf2aa53e8ff 100644
--- a/clang/test/SemaObjC/category-1.m
+++ b/clang/test/SemaObjC/category-1.m
@@ -62,16 +62,16 @@
// <rdar://problem/7249233>
@protocol MultipleCat_P
--(void) im0;
+-(void) im0; // expected-note {{method definition for 'im0' not found}}
@end
-@interface MultipleCat_I @end
+@interface MultipleCat_I @end // expected-note {{required for direct or indirect protocol 'MultipleCat_P'}}
@interface MultipleCat_I() @end
@interface MultipleCat_I() <MultipleCat_P> @end
-@implementation MultipleCat_I // expected-warning {{incomplete implementation}}, expected-warning {{method definition for 'im0' not found}}
+@implementation MultipleCat_I // expected-warning {{incomplete implementation}}
@end
// <rdar://problem/7680391> - Handle nameless categories with no name that refer
diff --git a/clang/test/SemaObjC/compare-qualified-id.m b/clang/test/SemaObjC/compare-qualified-id.m
index 497a1b6afdc..f4ec2540287 100644
--- a/clang/test/SemaObjC/compare-qualified-id.m
+++ b/clang/test/SemaObjC/compare-qualified-id.m
@@ -5,7 +5,7 @@ typedef unsigned int NSUInteger;
typedef struct _NSZone NSZone;
@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
@protocol NSObject - (BOOL)isEqual:(id)object; @end
-@protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end
+@protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end // expected-note {{method definition for 'copyWithZone:' not found}}
@protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; @end
@protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; @end
@interface NSObject <NSObject> {} @end
@@ -15,7 +15,7 @@ typedef struct {} NSFastEnumerationState;
@interface NSMutableDictionary : NSDictionary - (void)removeObjectForKey:(id)aKey; @end
extern NSString * const NSTaskDidTerminateNotification;
-@interface XCPropertyExpansionContext : NSObject <NSCopying> {
+@interface XCPropertyExpansionContext : NSObject <NSCopying> { // expected-note {{required for direct or indirect protocol 'NSCopying'}}
NSMutableDictionary * _propNamesToPropValuesCache;
} @end
@@ -23,8 +23,7 @@ extern NSString * const NSTaskDidTerminateNotification;
- (NSString *)evaluateAsStringInContext:(XCPropertyExpansionContext *)context withNestingState:(const void *)state;
@end
-@implementation XCPropertyExpansionContext // expected-warning {{method definition for 'copyWithZone:' not found}} \
- // expected-warning {{incomplete implementation}}
+@implementation XCPropertyExpansionContext // expected-warning {{incomplete implementation}}
- (NSString *)expandedValueForProperty:(NSString *)property {
id <XCPropertyValues> cachedValueNode = [_propNamesToPropValuesCache objectForKey:property]; // expected-warning {{method '-objectForKey:' not found (return type defaults to 'id')}}
if (cachedValueNode == ((void *)0)) { }
diff --git a/clang/test/SemaObjC/conditional-expr.m b/clang/test/SemaObjC/conditional-expr.m
index 914e3cabbf0..1436f7ee0e0 100644
--- a/clang/test/SemaObjC/conditional-expr.m
+++ b/clang/test/SemaObjC/conditional-expr.m
@@ -21,10 +21,10 @@
@end
@interface DTFilterOutputStream2
-- nextOutputStream;
+- nextOutputStream; // expected-note {{{{method definition for 'nextOutputStream' not found}}
@end
-@implementation DTFilterOutputStream2 // expected-warning {{incomplete implementation}} expected-warning {{method definition for 'nextOutputStream' not found}}
+@implementation DTFilterOutputStream2 // expected-warning {{incomplete implementation}}
- (id)initWithNextOutputStream:(id <DTOutputStreams>) outputStream {
id <DTOutputStreams> nextOutputStream = [self nextOutputStream];
self = nextOutputStream; // expected-warning {{incompatible type assigning 'id<DTOutputStreams>', expected 'DTFilterOutputStream2 *'}}
diff --git a/clang/test/SemaObjC/gcc-cast-ext.m b/clang/test/SemaObjC/gcc-cast-ext.m
index 28abfbc8b2a..599e37d7783 100644
--- a/clang/test/SemaObjC/gcc-cast-ext.m
+++ b/clang/test/SemaObjC/gcc-cast-ext.m
@@ -5,8 +5,8 @@ typedef struct _NSRange { } NSRange;
@class PBXFileReference;
@interface PBXDocBookmark
-+ alloc;
-- autorelease;
++ alloc; // expected-note {{{{method definition for 'alloc' not found}}
+- autorelease; // expected-note {{{{method definition for 'autorelease' not found}}
@end
// GCC allows pointer expressions in integer constant expressions.
@@ -14,7 +14,7 @@ struct {
char control[((int)(char *)2)];
} xx;
-@implementation PBXDocBookmark // expected-warning {{incomplete implementation}} expected-warning {{method definition for 'autorelease' not found}} expected-warning {{method definition for 'alloc' not found}}
+@implementation PBXDocBookmark // expected-warning {{incomplete implementation}}
+ (id)bookmarkWithFileReference:(PBXFileReference *)fileRef gylphRange:(NSRange)range anchor:(NSString *)htmlAnchor
{
diff --git a/clang/test/SemaObjC/method-arg-decay.m b/clang/test/SemaObjC/method-arg-decay.m
index f600029fda7..e62e7f3d18f 100644
--- a/clang/test/SemaObjC/method-arg-decay.m
+++ b/clang/test/SemaObjC/method-arg-decay.m
@@ -56,7 +56,7 @@ PBXFindMatchContains, PBXFindMatchStartsWith, PBXFindMatchWholeWords,
@interface PBXProjectModule : PBXModule <PBXFindableText> {
}
@end @class PBXBookmark;
-@protocol PBXSelectionTarget - (NSObject <PBXSelectionTarget> *) performAction:(id)action withSelection:(NSArray *)selection;
+@protocol PBXSelectionTarget - (NSObject <PBXSelectionTarget> *) performAction:(id)action withSelection:(NSArray *)selection; // expected-note {{method definition for 'performAction:withSelection:' not found}}
@end @class XCPropertyDictionary, XCPropertyCondition, XCPropertyConditionSet, XCMutablePropertyConditionSet;
extern NSMutableArray *XCFindPossibleKeyModules(PBXModule *module, BOOL useExposedModulesOnly);
@interface NSString (StringUtilities) - (NSString *) trimToLength:(NSInteger)length preserveRange:(NSRange)range;
@@ -67,14 +67,12 @@ extern NSMutableArray *XCFindPossibleKeyModules(PBXModule *module, BOOL useExpos
@interface XCExtendedTabView : NSTabView <XCDockViewHeader> {
}
@end @class PBXProjectDocument, PBXFileReference, PBXModule, XCWindowTool;
-@interface XCPerspectiveModule : PBXProjectModule <PBXSelectionTarget> {
+@interface XCPerspectiveModule : PBXProjectModule <PBXSelectionTarget> { // expected-note {{required for direct or indirect protocol 'PBXSelectionTarget'}}
XCExtendedTabView *_perspectivesTabView;
}
-- (PBXModule *) moduleForTab:(NSTabViewItem *)item;
+- (PBXModule *) moduleForTab:(NSTabViewItem *)item; // expected-note {{method definition for 'moduleForTab:' not found}}
@end
-@implementation XCPerspectiveModule // expected-warning {{method definition for 'moduleForTab:' not found}} \
- // expected-warning {{method definition for 'performAction:withSelection:' not found}} \
- // expected-warning {{incomplete implementation}}
+@implementation XCPerspectiveModule // expected-warning {{incomplete implementation}}
+ (void) openForProjectDocument:(PBXProjectDocument *)projectDocument {
}
- (PBXModule *) type:(Class)type inPerspective:(id)perspectiveIdentifer matchingFunction:(BOOL (void *, void *))comparator usingData:(void *)data {
diff --git a/clang/test/SemaObjC/method-undef-category-warn-1.m b/clang/test/SemaObjC/method-undef-category-warn-1.m
index 75ca5b5ff9f..dace8ab2949 100644
--- a/clang/test/SemaObjC/method-undef-category-warn-1.m
+++ b/clang/test/SemaObjC/method-undef-category-warn-1.m
@@ -1,30 +1,26 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-@interface MyClass1
+@interface MyClass1 // expected-note 2 {{required for direct or indirect protocol 'P'}}
@end
@protocol P
-- (void) Pmeth;
-- (void) Pmeth1;
+- (void) Pmeth; // expected-note {{method definition for 'Pmeth' not found}}
+- (void) Pmeth1; // expected-note {{method definition for 'Pmeth1' not found}}
@end
@interface MyClass1(CAT) <P>
-- (void) meth2;
+- (void) meth2; // expected-note {{method definition for 'meth2' not found}}
@end
-@implementation MyClass1(CAT) // expected-warning {{incomplete implementation}} \
- expected-warning {{method definition for 'meth2' not found}} \
- expected-warning {{method definition for 'Pmeth' not found}}
+@implementation MyClass1(CAT) // expected-warning {{incomplete implementation}}
- (void) Pmeth1{}
@end
@interface MyClass1(DOG) <P>
-- (void)ppp;
+- (void)ppp; // expected-note {{method definition for 'ppp' not found}}
@end
-@implementation MyClass1(DOG) // expected-warning {{incomplete implementation}} \
- expected-warning {{method definition for 'ppp' not found}} \
- expected-warning {{method definition for 'Pmeth1' not found}}
+@implementation MyClass1(DOG) // expected-warning {{incomplete implementation}}
- (void) Pmeth {}
@end
diff --git a/clang/test/SemaObjC/method-undef-extension-warn-1.m b/clang/test/SemaObjC/method-undef-extension-warn-1.m
index fc27870f42d..cd31754037c 100644
--- a/clang/test/SemaObjC/method-undef-extension-warn-1.m
+++ b/clang/test/SemaObjC/method-undef-extension-warn-1.m
@@ -1,16 +1,16 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-@interface MyClass
+@interface MyClass // expected-note {{required for direct or indirect protocol 'P'}}
@end
@protocol P
- (void)Pmeth;
-- (void)Pmeth1;
+- (void)Pmeth1; // expected-note {{method definition for 'Pmeth1' not found}}
@end
// Class extension
@interface MyClass () <P>
-- (void)meth2;
+- (void)meth2; // expected-note {{method definition for 'meth2' not found}}
@end
// Add a category to test that clang does not emit warning for this method.
@@ -18,8 +18,6 @@
- (void)categoryMethod;
@end
-@implementation MyClass // expected-warning {{incomplete implementation}} \
- expected-warning {{method definition for 'meth2' not found}} \
- expected-warning {{method definition for 'Pmeth1' not found}}
+@implementation MyClass // expected-warning {{incomplete implementation}}
- (void)Pmeth {}
@end
diff --git a/clang/test/SemaObjC/method-undefined-warn-1.m b/clang/test/SemaObjC/method-undefined-warn-1.m
index cfe1d56ee5c..1ebc59e96b3 100644
--- a/clang/test/SemaObjC/method-undefined-warn-1.m
+++ b/clang/test/SemaObjC/method-undefined-warn-1.m
@@ -3,12 +3,12 @@
@interface INTF
- (void) meth;
- (void) meth : (int) arg1;
-- (int) int_meth;
-+ (int) cls_meth;
-+ (void) cls_meth1 : (int) arg1;
+- (int) int_meth; // expected-note {{method definition for 'int_meth' not found}}
++ (int) cls_meth; // expected-note {{method definition for 'cls_meth' not found}}
++ (void) cls_meth1 : (int) arg1; // expected-note {{method definition for 'cls_meth1:' not found}}
@end
-@implementation INTF // expected-warning {{incomplete implementation}} expected-warning {{method definition for 'int_meth' not found}} expected-warning {{method definition for 'cls_meth' not found}} expected-warning {{method definition for 'cls_meth1:' not found}}
+@implementation INTF // expected-warning {{incomplete implementation}}
- (void) meth {}
- (void) meth : (int) arg2{}
- (void) cls_meth1 : (int) arg2{}
@@ -17,12 +17,12 @@
@interface INTF1
- (void) meth;
- (void) meth : (int) arg1;
-- (int) int_meth;
-+ (int) cls_meth;
-+ (void) cls_meth1 : (int) arg1;
+- (int) int_meth; // expected-note {{method definition for 'int_meth' not found}}
++ (int) cls_meth; // expected-note {{method definition for 'cls_meth' not found}}
++ (void) cls_meth1 : (int) arg1; // expected-note {{method definition for 'cls_meth1:' not found}}
@end
-@implementation INTF1 // expected-warning {{incomplete implementation}} expected-warning {{method definition for 'int_meth' not found}} expected-warning {{method definition for 'cls_meth' not found}} expected-warning {{method definition for 'cls_meth1:' not found}}
+@implementation INTF1 // expected-warning {{incomplete implementation}}
- (void) meth {}
- (void) meth : (int) arg2{}
- (void) cls_meth1 : (int) arg2{}
diff --git a/clang/test/SemaObjC/undef-protocol-methods-1.m b/clang/test/SemaObjC/undef-protocol-methods-1.m
index 9a35ef7ba80..6871ff06fc5 100644
--- a/clang/test/SemaObjC/undef-protocol-methods-1.m
+++ b/clang/test/SemaObjC/undef-protocol-methods-1.m
@@ -1,40 +1,34 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol P1
-- (void) P1proto;
-+ (void) ClsP1Proto;
+- (void) P1proto; // expected-note {{method definition for 'P1proto' not found}}
++ (void) ClsP1Proto; // expected-note {{method definition for 'ClsP1Proto' not found}}
- (void) DefP1proto;
@end
@protocol P2
-- (void) P2proto;
-+ (void) ClsP2Proto;
+- (void) P2proto; // expected-note {{method definition for 'P2proto' not found}}
++ (void) ClsP2Proto; // expected-note {{method definition for 'ClsP2Proto' not found}}
@end
@protocol P3<P2>
-- (void) P3proto;
-+ (void) ClsP3Proto;
+- (void) P3proto; // expected-note {{method definition for 'P3proto' not found}}
++ (void) ClsP3Proto; // expected-note {{method definition for 'ClsP3Proto' not found}}
+ (void) DefClsP3Proto;
@end
@protocol PROTO<P1, P3>
-- (void) meth;
-- (void) meth : (int) arg1;
-+ (void) cls_meth : (int) arg1;
+- (void) meth; // expected-note {{method definition for 'meth' not found}}
+- (void) meth : (int) arg1; // expected-note {{method definition for 'meth:' not found}}
++ (void) cls_meth : (int) arg1; // expected-note {{method definition for 'cls_meth:' not found}}
@end
-@interface INTF <PROTO>
+@interface INTF <PROTO> // expected-note 3 {{required for direct or indirect protocol 'PROTO'}} \
+ // expected-note 2 {{required for direct or indirect protocol 'P1'}} \
+ // expected-note 2 {{required for direct or indirect protocol 'P3'}} \
+ // expected-note 2 {{required for direct or indirect protocol 'P2'}}
@end
-@implementation INTF // expected-warning {{incomplete implementation}} \
- expected-warning {{method definition for 'meth' not found}} \
- expected-warning {{method definition for 'meth:' not found}} \
- expected-warning {{method definition for 'cls_meth:' not found}} \
- expected-warning {{method definition for 'P3proto' not found}} \
- expected-warning {{method definition for 'ClsP3Proto' not found}} \
- expected-warning {{method definition for 'P2proto' not found}} \
- expected-warning {{method definition for 'ClsP2Proto' not found}} \
- expected-warning {{method definition for 'ClsP1Proto' not found}} \
- expected-warning {{method definition for 'P1proto' not found}}
+@implementation INTF // expected-warning {{incomplete implementation}}
- (void) DefP1proto{}
+ (void) DefClsP3Proto{}
OpenPOWER on IntegriCloud