1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name macroparams2.c %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc
3*0a6a1f1dSLionel Sambuc // A test case for when the first macro parameter is used after the second
4*0a6a1f1dSLionel Sambuc // macro parameter.
5*0a6a1f1dSLionel Sambuc
6*0a6a1f1dSLionel Sambuc struct S {
7*0a6a1f1dSLionel Sambuc int i, j;
8*0a6a1f1dSLionel Sambuc };
9*0a6a1f1dSLionel Sambuc
10*0a6a1f1dSLionel Sambuc #define MACRO(REFS, CALLS) (4 * (CALLS) < (REFS))
11*0a6a1f1dSLionel Sambuc
main()12*0a6a1f1dSLionel Sambuc int main() { // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+7]]:2 = #0 (HasCodeBefore = 0)
13*0a6a1f1dSLionel Sambuc struct S arr[32] = { 0 }; // CHECK-NEXT: Expansion,File 0, [[@LINE+2]]:7 -> [[@LINE+2]]:12 = #0 (HasCodeBefore = 0, Expanded file = 1)
14*0a6a1f1dSLionel Sambuc int n = 0; // CHECK-NEXT: File 0, [[@LINE+1]]:13 -> [[@LINE+1]]:21 = #0 (HasCodeBefore = 0)
15*0a6a1f1dSLionel Sambuc if (MACRO(arr[n].j, arr[n].i)) { // CHECK-NEXT: File 0, [[@LINE]]:23 -> [[@LINE]]:31 = #0 (HasCodeBefore = 0)
16*0a6a1f1dSLionel Sambuc n = 1; // CHECK-NEXT: File 0, [[@LINE-1]]:34 -> [[@LINE+1]]:4 = #1 (HasCodeBefore = 0)
17*0a6a1f1dSLionel Sambuc }
18*0a6a1f1dSLionel Sambuc return n;
19*0a6a1f1dSLionel Sambuc } // CHECK-NEXT: File 1, [[@LINE-9]]:29 -> [[@LINE-9]]:51 = #0 (HasCodeBefore = 0
20*0a6a1f1dSLionel Sambuc
21