aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-01-30 21:35:30 +0000
committerTed Kremenek <kremenek@apple.com>2009-01-30 21:35:30 +0000
commitbf98c99600017bfcdde2a7966c47a6beb15a96dc (patch)
tree3e07521a56372988baaa16341f74813e2245f802 /test
parentf87a0ccb05eb2aa095ea835fdcdf4a0363637b28 (diff)
Fix horrible non-termination bug in LiveVariables. The issue was that
the liveness state of block-level expressions could oscillate because of two issues: - The initial value before a merge was not always set to "Top" - The set of live block-level expressions is a union, not an intersection This fixes <rdar://problem/650084>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63421 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Analysis/rdar-6540084.m36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/Analysis/rdar-6540084.m b/test/Analysis/rdar-6540084.m
new file mode 100644
index 0000000000..e1347d92eb
--- /dev/null
+++ b/test/Analysis/rdar-6540084.m
@@ -0,0 +1,36 @@
+// RUN: clang -analyze -warn-dead-stores -verify %s
+//
+// This test exercises the live variables analysis (LiveVariables.cpp).
+// The case originally identified a non-termination bug.
+//
+typedef signed char BOOL;
+typedef unsigned int NSUInteger;
+typedef struct _NSZone NSZone;
+@protocol NSObject - (BOOL)isEqual:(id)object; @end
+@interface NSObject <NSObject> {} @end
+extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
+@class NSArray;
+@class NSMutableArray, NSIndexSet, NSView, NSPredicate, NSString, NSViewAnimation, NSTimer;
+@interface FooBazController : NSObject {}
+@end
+typedef struct {} TazVersion;
+@class TazNode;
+@interface TazGuttenberg : NSObject {} typedef NSUInteger BugsBunnyType; @end
+@interface FooBaz : NSObject {}
+@property (nonatomic) BugsBunnyType matchType;
+@property (nonatomic, retain) NSArray *papyrus; @end
+@implementation FooBazController
+- (NSArray *)excitingStuff:(FooBaz *)options {
+ BugsBunnyType matchType = options.matchType;
+ NSPredicate *isSearchablePredicate = [NSPredicate predicateWithFormat:@"isSearchable == YES"]; // expected-warning{{return type defaults to 'id'}}
+ for (TazGuttenberg *Guttenberg in options.papyrus) {
+ NSArray *GuttenbergNodes = [Guttenberg nodes]; // expected-warning{{return type defaults to 'id'}}
+ NSArray *searchableNodes = [GuttenbergNodes filteredArrayUsingPredicate:isSearchablePredicate]; // expected-warning{{return type defaults to 'id'}}
+ for (TazNode *node in searchableNodes) {
+ switch (matchType) {
+ default: break;
+ }
+ }
+ }
+}
+@end