Kuba Mracek e4c1dd2c08 [tsan] Enable ignore_noninstrumented_modules=1 on Darwin by default
TSan recently got the "ignore_noninstrumented_modules" flag, which disables tracking of read and writes that come from noninstrumented modules (via interceptors). This is a way of suppressing false positives coming from system libraries and other noninstrumented code. This patch turns this on by default on Darwin, where it's supposed to replace the previous solution, "ignore_interceptors_accesses", which disables tracking in *all* interceptors. The new approach should re-enable TSan's ability to find races via interceptors on Darwin.

Differential Revision: https://reviews.llvm.org/D29041

llvm-svn: 292981
2017-01-24 21:37:50 +00:00

37 lines
894 B
Plaintext

// RUN: %clang_tsan %s -o %t -framework Foundation
// RUN: %run %t 2>&1 | FileCheck %s
#import <Foundation/Foundation.h>
long global;
int main(int argc, const char *argv[]) {
fprintf(stderr, "Hello world.\n");
dispatch_queue_t q = dispatch_queue_create("my.queue", DISPATCH_QUEUE_SERIAL);
dispatch_semaphore_t sem = dispatch_semaphore_create(0);
global = 44;
dispatch_data_t data = dispatch_data_create("buffer", 6, q, ^{
fprintf(stderr, "Data destructor.\n");
global++;
dispatch_semaphore_signal(sem);
});
dispatch_release(data);
data = nil;
dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
data = dispatch_data_create("buffer", 6, q, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
dispatch_release(data);
data = nil;
fprintf(stderr, "Done.\n");
}
// CHECK: Hello world.
// CHECK: Data destructor.
// CHECK-NOT: WARNING: ThreadSanitizer
// CHECK: Done.