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