reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
// RUN: %clangxx_tsan %s -o %t -framework Foundation -fobjc-arc %darwin_min_target_with_full_runtime_arc_support
// RUN: %run %t 2>&1 | FileCheck %s

#import <Foundation/Foundation.h>

int main() {
  @autoreleasepool {
    NSObject* obj1 = [NSObject new];
    NSObject* obj2 = [NSObject new];

    @synchronized(obj1) {
      @synchronized(obj1) {
        NSLog(@"nested 1-1");
// CHECK: nested 1-1
      }
    }

    @synchronized(obj1) {
      @synchronized(obj2) {
        @synchronized(obj1) {
          @synchronized(obj2) {
            NSLog(@"nested 1-2-1-2");
// CHECK: nested 1-2-1-2
          }
        }
      }
    }

  }

  NSLog(@"PASS");
// CHECK-NOT: ThreadSanitizer
// CHECK: PASS
  return 0;
}