From 5a29f3c05e08f855a97a547acaa2d95df13b55b3 Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Wed, 14 Nov 2012 23:03:55 +0000 Subject: [PATCH] [analyzer] Add a test case for printing a path note at a PreStmt point. This is also a false-positive test case for . llvm-svn: 167994 --- clang/test/Analysis/blocks.m | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/clang/test/Analysis/blocks.m b/clang/test/Analysis/blocks.m index 54ff58c..a64e8e4 100644 --- a/clang/test/Analysis/blocks.m +++ b/clang/test/Analysis/blocks.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core -analyzer-store=region -fblocks -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core -analyzer-store=region -fblocks -analyzer-opt-analyze-nested-blocks -verify %s //===----------------------------------------------------------------------===// // The following code is reduced using delta-debugging from Mac OS X headers: @@ -26,6 +26,7 @@ typedef struct _NSZone NSZone; @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; @end @interface NSObject {} + (id)alloc; +- (id)init; - (id)copy; @end extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone); @@ -94,3 +95,29 @@ void testMessaging() { // [[^(){} copy] release]; } + + +// FALSE POSITIVE +@interface rdar12415065 +@end + +@implementation rdar12415065 +- (void)test { + // At one point this crashed because we created a path note at a + // PreStmtPurgeDeadSymbols point but only knew how to deal with PostStmt + // points. + + extern dispatch_queue_t queue; + + if (!queue) + return; + + dispatch_async(queue, ^{ + double x = 0.0; + if (24.0f < x) { + dispatch_async(queue, ^{ (void)x; }); + [self test]; + } + }); +} +@end -- 2.7.4