blob: 4d191d2f1e356b6798575761ab79908d9ae85a36 [file] [log] [blame]
Ted Kremenek8382cf52009-11-13 18:46:29 +00001// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s
Ted Kremenekbf98c992009-01-30 21:35:30 +00002//
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; @end
10@interface NSObject <NSObject> {} @end
11extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
12@class NSArray;
13@class NSMutableArray, NSIndexSet, NSView, NSPredicate, NSString, NSViewAnimation, NSTimer;
14@interface FooBazController : NSObject {}
15@end
16typedef struct {} TazVersion;
17@class TazNode;
18@interface TazGuttenberg : NSObject {} typedef NSUInteger BugsBunnyType; @end
19@interface FooBaz : NSObject {}
20@property (nonatomic) BugsBunnyType matchType;
21@property (nonatomic, retain) NSArray *papyrus; @end
22@implementation FooBazController
23- (NSArray *)excitingStuff:(FooBaz *)options {
24 BugsBunnyType matchType = options.matchType;
Fariborz Jahanian9f8f0262009-05-08 23:45:49 +000025 NSPredicate *isSearchablePredicate = [NSPredicate predicateWithFormat:@"isSearchable == YES"]; // expected-warning{{receiver 'NSPredicate' is a forward class and corresponding}} // expected-warning{{return type defaults to 'id'}}
Ted Kremenekbf98c992009-01-30 21:35:30 +000026 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 }
Mike Stump28b22272009-07-21 18:56:04 +000035 while (1) {}
Ted Kremenekbf98c992009-01-30 21:35:30 +000036}
37@end