blob: 3d862c0bf7ed32bad860e2dbd41c900f4a76a0dc [file] [log] [blame]
Anna Zakse43b4fc2017-01-13 00:50:50 +00001// RUN: %clang_cc1 -triple x86_64-apple-darwin -x objective-c++ -fblocks -emit-llvm -o - %s | FileCheck -check-prefix=WITHOUT %s
2// RUN: %clang_cc1 -triple x86_64-apple-darwin -x objective-c++ -fblocks -emit-llvm -o - %s -fsanitize=thread | FileCheck -check-prefix=TSAN %s
3
4// WITHOUT-NOT: "sanitize_thread_no_checking_at_run_time"
Anna Zaksbcd35a82016-11-11 23:22:44 +00005
6__attribute__((objc_root_class))
7@interface NSObject
8- (void)dealloc;
9@end
10
11class NeedCleanup {
12public:
13 ~NeedCleanup() __attribute__((no_sanitize("thread"))) {}
14};
15
16@interface MyObject : NSObject {
17 NeedCleanup v;
18};
19+ (void) initialize;
20- (void) dealloc;
21@end
22
23@implementation MyObject
24+ (void)initialize {
25}
26- (void)dealloc {
27 [super dealloc];
28}
29@end
30
Anna Zaksbcd35a82016-11-11 23:22:44 +000031// TSAN: initialize{{.*}}) [[ATTR:#[0-9]+]]
32// TSAN: dealloc{{.*}}) [[ATTR:#[0-9]+]]
33// TSAN: cxx_destruct{{.*}}) [[ATTR:#[0-9]+]]
Anna Zakse43b4fc2017-01-13 00:50:50 +000034
35void test2(id x) {
36 extern void test2_helper(id (^)(void));
37 test2_helper(^{ return x; });
38// TSAN: define internal void @__destroy_helper_block_(i8*) [[ATTR:#[0-9]+]]
39}
40
Chandler Carruthfcd33142016-12-23 01:24:49 +000041// TSAN: attributes [[ATTR]] = { noinline nounwind {{.*}} "sanitize_thread_no_checking_at_run_time" {{.*}} }