38 lines · plain
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core -analyzer-checker=deadcode.DeadStores -verify %s2//3// This test exercises the live variables analysis (LiveVariables.cpp).4// The case originally identified a non-termination bug.5//6typedef signed char BOOL;7typedef unsigned int NSUInteger;8typedef struct _NSZone NSZone;9@protocol NSObject - (BOOL)isEqual:(id)object; @end10@interface NSObject <NSObject> {} @end11extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);12@class NSArray; // expected-note {{receiver is instance of class declared here}}13@class NSMutableArray, NSIndexSet, NSView, NSPredicate, NSString, NSViewAnimation, NSTimer; // expected-note{{forward declaration of class here}}14@interface FooBazController : NSObject {}15@end16typedef struct {} TazVersion;17@class TazNode;18@interface TazGuttenberg : NSObject {} typedef NSUInteger BugsBunnyType; @end // expected-note {{receiver is instance of class declared here}}19@interface FooBaz : NSObject {}20@property (nonatomic) BugsBunnyType matchType;21@property (nonatomic, retain) NSArray *papyrus; @end22@implementation FooBazController23- (NSArray *)excitingStuff:(FooBaz *)options {24 BugsBunnyType matchType = options.matchType;25 NSPredicate *isSearchablePredicate = [NSPredicate predicateWithFormat:@"isSearchable == YES"]; // expected-warning{{receiver 'NSPredicate' is a forward class and corresponding}} // expected-warning{{return type defaults to 'id'}}26 for (TazGuttenberg *Guttenberg in options.papyrus) {27 NSArray *GuttenbergNodes = [Guttenberg nodes]; // expected-warning{{return type defaults to 'id'}}28 NSArray *searchableNodes = [GuttenbergNodes filteredArrayUsingPredicate:isSearchablePredicate]; // expected-warning{{return type defaults to 'id'}}29 for (TazNode *node in searchableNodes) {30 switch (matchType) {31 default: break;32 }33 }34 }35 while (1) {}36}37@end38