56 lines · c
1// This test checks that the cycle detection algorithm in llvm-cov is able to2// handle complex block graphs by skipping zero count cycles.3//4// RUN: mkdir -p %t.dir && cd %t.dir5// RUN: %clang --coverage %s -o %t -dumpdir ./6// RUN: rm -f gcov-complex-line.gcda && %run %t7// RUN: llvm-cov gcov -t gcov-complex-line.c | FileCheck %s8 9#define M_0 \10 do { \11 if (x == 0) \12 x = 0; \13 else \14 x = 1; \15 } while (0)16#define M_1 \17 do { \18 M_0; \19 M_0; \20 M_0; \21 M_0; \22 } while (0)23#define M_2 \24 do { \25 M_1; \26 M_1; \27 M_1; \28 M_1; \29 } while (0)30#define M_3 \31 do { \32 M_2; \33 M_2; \34 M_2; \35 M_2; \36 } while (0)37#define M_4 \38 do { \39 M_3; \40 M_3; \41 M_3; \42 M_3; \43 } while (0)44#define COMPLEX_LINE \45 do { \46 for (int i = 0; i < 100; ++i) \47 M_4; \48 } while (0)49 50int main() {51 volatile int x = 0;52 // In the following line, the number of cycles in the block graph is at least53 // 2^256, where 256 is the number of expansions of M_0.54 COMPLEX_LINE; // CHECK: 101: [[#@LINE]]: COMPLEX_LINE;55}56