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