Ted Kremenek | cdc3a89 | 2012-08-24 20:39:55 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,alpha.core -analyzer-store=region -verify %s |
Ted Kremenek | 70b6a83 | 2009-05-13 18:16:01 +0000 | [diff] [blame] | 2 | |
| 3 | // This test case was crashing due to how CFRefCount.cpp resolved the |
| 4 | // ObjCInterfaceDecl* and ClassName in EvalObjCMessageExpr. |
| 5 | |
| 6 | typedef signed char BOOL; |
| 7 | typedef unsigned int NSUInteger; |
| 8 | typedef struct _NSZone NSZone; |
| 9 | @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; |
| 10 | @protocol NSObject - (BOOL)isEqual:(id)object; |
| 11 | @end @protocol NSCopying - (id)copyWithZone:(NSZone *)zone; |
| 12 | @end @protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; |
| 13 | @end @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; |
| 14 | @end @interface NSObject <NSObject> { |
| 15 | } |
| 16 | @end typedef float CGFloat; |
| 17 | typedef struct _NSPoint { |
| 18 | } |
| 19 | NSFastEnumerationState; |
| 20 | @protocol NSFastEnumeration - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len; |
| 21 | @end @class NSString; |
| 22 | @interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration> - (NSUInteger)count; |
| 23 | @end @interface NSMutableArray : NSArray - (void)addObject:(id)anObject; |
| 24 | @end typedef unsigned short unichar; |
| 25 | @interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding> - (NSUInteger)length; |
| 26 | - (int)intValue; |
| 27 | @end @interface NSSimpleCString : NSString { |
| 28 | } |
| 29 | @end @interface NSConstantString : NSSimpleCString @end extern void *_NSConstantStringClassReference; |
| 30 | @interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration> - (NSUInteger)count; |
| 31 | @end @interface NSMutableDictionary : NSDictionary - (void)removeObjectForKey:(id)aKey; |
| 32 | @end typedef struct { |
| 33 | } |
| 34 | CMProfileLocation; |
| 35 | @interface NSResponder : NSObject <NSCoding> { |
| 36 | } |
| 37 | @end @class NSAttributedString, NSEvent, NSFont, NSFormatter, NSImage, NSMenu, NSText, NSView; |
| 38 | @interface NSCell : NSObject <NSCopying, NSCoding> { |
| 39 | } |
| 40 | @end extern NSString *NSControlTintDidChangeNotification; |
| 41 | @interface NSActionCell : NSCell { |
| 42 | } |
| 43 | @end @class NSArray, NSDocument, NSWindow; |
| 44 | @interface NSWindowController : NSResponder <NSCoding> { |
| 45 | } |
| 46 | @end @class EBayCategoryType, GSEbayCategory, GBSearchRequest; |
| 47 | @interface GBCategoryChooserPanelController : NSWindowController { |
| 48 | GSEbayCategory *rootCategory; |
| 49 | } |
Fariborz Jahanian | 8822f7c | 2010-03-27 19:02:17 +0000 | [diff] [blame] | 50 | - (NSMutableDictionary*)categoryDictionaryForCategoryID:(int)inID inRootTreeCategories:(NSMutableArray*)inRootTreeCategories; // expected-note {{method definition for 'categoryDictionaryForCategoryID:inRootTreeCategories:' not found}} |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 51 | -(NSString*) categoryID; // expected-note {{method definition for 'categoryID' not found}} expected-note {{using}} |
Ted Kremenek | 70b6a83 | 2009-05-13 18:16:01 +0000 | [diff] [blame] | 52 | @end @interface GSEbayCategory : NSObject <NSCoding> { |
| 53 | } |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 54 | - (int) categoryID; // expected-note {{also found}} |
Ted Kremenek | 70b6a83 | 2009-05-13 18:16:01 +0000 | [diff] [blame] | 55 | - (GSEbayCategory *) parent; |
| 56 | - (GSEbayCategory*) subcategoryWithID:(int) inID; |
Fariborz Jahanian | 8822f7c | 2010-03-27 19:02:17 +0000 | [diff] [blame] | 57 | @end @implementation GBCategoryChooserPanelController + (int) chooseCategoryIDFromCategories:(NSArray*) inCategories searchRequest:(GBSearchRequest*)inRequest parentWindow:(NSWindow*) inParent { // expected-warning {{incomplete implementation}} |
Mike Stump | 6581c30 | 2009-07-21 18:57:14 +0000 | [diff] [blame] | 58 | return 0; |
Ted Kremenek | 70b6a83 | 2009-05-13 18:16:01 +0000 | [diff] [blame] | 59 | } |
| 60 | - (void) addCategory:(EBayCategoryType*)inCategory toRootTreeCategory:(NSMutableArray*)inRootTreeCategories { |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 61 | GSEbayCategory *category = [rootCategory subcategoryWithID:[[inCategory categoryID] intValue]]; // expected-warning {{multiple methods named 'categoryID' found}} |
Fariborz Jahanian | 63e963c | 2009-11-16 18:57:01 +0000 | [diff] [blame] | 62 | |
Ted Kremenek | 70b6a83 | 2009-05-13 18:16:01 +0000 | [diff] [blame] | 63 | if (rootCategory != category) { |
| 64 | GSEbayCategory *parent = category; |
| 65 | while ((((void*)0) != (parent = [parent parent])) && ([parent categoryID] != 0)) { |
| 66 | NSMutableDictionary *treeCategoryDict = [self categoryDictionaryForCategoryID:[parent categoryID] inRootTreeCategories:inRootTreeCategories]; |
| 67 | if (((void*)0) == treeCategoryDict) { |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | } |
Fariborz Jahanian | 63e963c | 2009-11-16 18:57:01 +0000 | [diff] [blame] | 72 | @end |