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