brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 1930041 Raw
25 lines · cpp
1// REQUIRES: lld-available2// XFAIL: powerpc64-target-arch3 4// RUN: %clangxx_profgen -std=gnu++17 -fuse-ld=lld -fcoverage-mapping -o %t %s5// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t6// RUN: llvm-profdata merge -o %t.profdata %t.profraw7// RUN: llvm-cov show %t -instr-profile=%t.profdata 2>&1 | FileCheck %s8 9#include <stdio.h>10 11// clang-format off12__attribute__ ((__noreturn__))13void foo(void) { while (1); }                   // CHECK:  [[@LINE]]| 0|void foo(void)14_Noreturn void bar(void) { while (1); }         // CHECK:  [[@LINE]]| 0|_Noreturn void bar(void)15                                                // CHECK:  [[@LINE]]|  |16int main(int argc, char **argv) {               // CHECK:  [[@LINE]]| 1|int main(17  int rc = ({ if (argc > 3) foo(); 0; });       // CHECK:  [[@LINE]]| 1|  int rc =18  printf("coverage after foo is present\n");    // CHECK:  [[@LINE]]| 1|  printf(19                                                // CHECK:  [[@LINE]]|  |20  int rc2 = ({ if (argc > 3) bar(); 0; });      // CHECK:  [[@LINE]]| 1|  int rc2 =21  printf("coverage after bar is present\n");    // CHECK:  [[@LINE]]| 1|  printf(22  return rc + rc2;                              // CHECK:  [[@LINE]]| 1|  return rc23}                                               // CHECK:  [[@LINE]]| 1|}24// clang-format on25