Clang Project

clang_source_code/test/CodeGen/sanitize-thread-no-checking-at-run-time.m
1// 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"
5
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
31// TSAN: initialize{{.*}}) [[ATTR:#[0-9]+]]
32// TSAN: dealloc{{.*}}) [[ATTR:#[0-9]+]]
33// TSAN: cxx_destruct{{.*}}) [[ATTR:#[0-9]+]]
34
35void test2(id x) {
36  extern void test2_helper(id (^)(void));
37  test2_helper(^{ return x; });
38// TSAN: define linkonce_odr hidden void @__destroy_helper_block_8_32o(i8*) unnamed_addr [[ATTR:#[0-9]+]]
39}
40
41// TSAN: attributes [[ATTR]] = { noinline nounwind {{.*}} "sanitize_thread_no_checking_at_run_time" {{.*}} }
42