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