blob: 16d3bc931c73803bc2b21a1a8a37348583e0927b [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; });
Akira Hatanaka9978da32018-08-10 15:09:24 +000038// TSAN: define linkonce_odr hidden void @__destroy_helper_block_8_32o(i8*) unnamed_addr [[ATTR:#[0-9]+]]
Anna Zakse43b4fc2017-01-13 00:50:50 +000039}
40
Chandler Carruthfcd33142016-12-23 01:24:49 +000041// TSAN: attributes [[ATTR]] = { noinline nounwind {{.*}} "sanitize_thread_no_checking_at_run_time" {{.*}} }