1 // RUN: %clang_profgen -fuse-ld=gold -O2 -fdata-sections -ffunction-sections -fprofile-instr-generate -fcoverage-mapping -Wl,--gc-sections -o %t %s 2 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t 3 // RUN: llvm-profdata merge -o %t.profdata %t.profraw 4 // RUN: llvm-cov show %t -instr-profile %t.profdata -filename-equivalence 2>&1 | FileCheck %s 5 // Testing PIE 6 // RUN: %clang_profgen -fuse-ld=gold -O2 -fdata-sections -ffunction-sections -fPIE -pie -fprofile-instr-generate -fcoverage-mapping -Wl,--gc-sections -o %t.pie %s 7 // RUN: env LLVM_PROFILE_FILE=%t.pie.profraw %run %t.pie 8 // RUN: llvm-profdata merge -o %t.pie.profdata %t.pie.profraw 9 // RUN: llvm-cov show %t.pie -instr-profile %t.pie.profdata -filename-equivalence 2>&1 | FileCheck %s 10 // testing m32 11 // RUN: %clang_profgen -fuse-ld=gold -O2 -fdata-sections -ffunction-sections -fPIE -pie -fprofile-instr-generate -fcoverage-mapping -m32 -Wl,--gc-sections -o %t.32.pie %s 12 // RUN: env LLVM_PROFILE_FILE=%t.32.pie.profraw %run %t.32.pie 13 // RUN: llvm-profdata merge -o %t.32.pie.profdata %t.32.pie.profraw 14 // RUN: llvm-cov show %t.32.pie -instr-profile %t.32.pie.profdata -filename-equivalence 2>&1 | FileCheck %s 15 16 void foo(bool cond) { // CHECK: 1| [[@LINE]]|void foo( 17 if (cond) { // CHECK: 1| [[@LINE]]| if (cond) { 18 } // CHECK: 0| [[@LINE]]| } 19 } // CHECK: 1| [[@LINE]]|} 20 void bar() { // CHECK: 1| [[@LINE]]|void bar() { 21 } // CHECK: 1| [[@LINE]]|} 22 void func() { // CHECK: 0| [[@LINE]]|void func( 23 } // CHECK: 0| [[@LINE]]|} 24 int main() { // CHECK: 1| [[@LINE]]|int main( 25 foo(false); // CHECK: 1| [[@LINE]]| foo( 26 bar(); // CHECK: 1| [[@LINE]]| bar( 27 return 0; // CHECK: 1| [[@LINE]]| return 28 } // CHECK: 1| [[@LINE]]|} 29 30 31 32 33 34