xref: /minix3/external/bsd/llvm/dist/clang/test/CoverageMapping/objc.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name objc.m -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc
3*0a6a1f1dSLionel Sambuc@interface A
4*0a6a1f1dSLionel Sambuc- (void)bork:(int)msg;
5*0a6a1f1dSLionel Sambuc@end
6*0a6a1f1dSLionel Sambuc
7*0a6a1f1dSLionel Sambuc                      // CHECK: func
8*0a6a1f1dSLionel Sambucvoid func(A *a) {     // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+3]]:2 = #0 (HasCodeBefore = 0)
9*0a6a1f1dSLionel Sambuc  if (a)
10*0a6a1f1dSLionel Sambuc    [a bork:  20  ];  // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:20 = #1 (HasCodeBefore = 0)
11*0a6a1f1dSLionel Sambuc}
12*0a6a1f1dSLionel Sambuc
13*0a6a1f1dSLionel Sambuc@interface NSArray
14*0a6a1f1dSLionel Sambuc+ (NSArray*) arrayWithObjects: (id) first, ...;
15*0a6a1f1dSLionel Sambuc- (unsigned) count;
16*0a6a1f1dSLionel Sambuc@end
17*0a6a1f1dSLionel Sambuc
18*0a6a1f1dSLionel Sambuc                               // CHECK: func2
19*0a6a1f1dSLionel Sambucvoid func2(NSArray *array) {   // CHECK-NEXT: File 0, [[@LINE]]:28 -> [[@LINE+10]]:2 = #0 (HasCodeBefore = 0)
20*0a6a1f1dSLionel Sambuc  int i = 0;
21*0a6a1f1dSLionel Sambuc  for (NSArray *x in array) {  // CHECK-NEXT: File 0, [[@LINE]]:29 -> [[@LINE+6]]:4 = #1 (HasCodeBefore = 0)
22*0a6a1f1dSLionel Sambuc    if (x) {                   // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = #2 (HasCodeBefore = 0)
23*0a6a1f1dSLionel Sambuc      i = 1;
24*0a6a1f1dSLionel Sambuc    } else {                   // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = (#1 - #2) (HasCodeBefore = 0)
25*0a6a1f1dSLionel Sambuc      i = -1;
26*0a6a1f1dSLionel Sambuc    }
27*0a6a1f1dSLionel Sambuc  }
28*0a6a1f1dSLionel Sambuc  i = 0;
29*0a6a1f1dSLionel Sambuc}
30