1// Test that the memory region that contains Objective-C block trampolines
2// is scanned.
3// FIXME: Find a way to reduce this without AppKit to remove Mac requirement.
4// UNSUPPORTED: ios
5// RUN: %clangxx_lsan %s -o %t -framework Cocoa -fno-objc-arc
6// RUN: %env_lsan_opts="report_objects=1" %run %t 2>&1 && echo "" | FileCheck %s
7
8#import <Cocoa/Cocoa.h>
9
10#include <sanitizer/lsan_interface.h>
11
12int main() {
13 NSView *view =
14 [[[NSView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)] autorelease];
15 __lsan_do_leak_check();
16 return 0;
17}
18// CHECK-NOT: LeakSanitizer: detected memory leaks
19

source code of compiler-rt/test/lsan/TestCases/Darwin/trampoline.mm