xref: /aosp_15_r20/external/compiler-rt/test/profile/Linux/extern_template.test (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger Robot// RUN: %clang -O2  -c -o %t.0.o %S/../Inputs/extern_template.cpp
2*7c3d14c8STreehugger Robot// RUN: %clang_profgen -O2  -c -o %t.o %S/../Inputs/extern_template.cpp
3*7c3d14c8STreehugger Robot// RUN: %clang_profgen -O2 -fcoverage-mapping %S/../Inputs/extern_template1.cpp %S/../Inputs/extern_template2.cpp %t.o -o %t
4*7c3d14c8STreehugger Robot// RUN: env LLVM_PROFILE_FILE=%t.profraw %t
5*7c3d14c8STreehugger Robot// RUN: llvm-profdata show --all-functions %t.profraw | FileCheck %s
6*7c3d14c8STreehugger Robot// RUN: llvm-profdata merge -o %t.profdata %t.profraw
7*7c3d14c8STreehugger Robot// RUN: llvm-cov show -instr-profile=%t.profdata %t | FileCheck %S/../Inputs/extern_template.h
8*7c3d14c8STreehugger Robot// RUN: %clang_profgen -O2 -fcoverage-mapping %S/../Inputs/extern_template1.cpp %S/../Inputs/extern_template2.cpp %t.0.o -o %t.0
9*7c3d14c8STreehugger Robot// RUN: env LLVM_PROFILE_FILE=%t.0.profraw %t.0
10*7c3d14c8STreehugger Robot// RUN: llvm-profdata show --all-functions %t.0.profraw | FileCheck %s
11*7c3d14c8STreehugger Robot// RUN: llvm-profdata merge -o %t.0.profdata %t.0.profraw
12*7c3d14c8STreehugger Robot// RUN: llvm-cov show -instr-profile=%t.0.profdata %t.0 | FileCheck %S/../Inputs/extern_template.h
13*7c3d14c8STreehugger Robot#define DEF
14*7c3d14c8STreehugger Robot#include "extern_template.h"
15*7c3d14c8STreehugger Robot#undef DEF
16*7c3d14c8STreehugger Robotextern int bar();
17*7c3d14c8STreehugger Robotextern int foo();
18*7c3d14c8STreehugger Robotextern Test<int> TO;
19*7c3d14c8STreehugger Robotint main() {
20*7c3d14c8STreehugger Robot  foo();
21*7c3d14c8STreehugger Robot  int R = bar();
22*7c3d14c8STreehugger Robot
23*7c3d14c8STreehugger Robot  if (R != 10)
24*7c3d14c8STreehugger Robot    return 1;
25*7c3d14c8STreehugger Robot  return 0;
26*7c3d14c8STreehugger Robot}
27*7c3d14c8STreehugger Robot// No duplicate entries
28*7c3d14c8STreehugger Robot// CHECK: _ZN4TestIiE4doItEi:
29*7c3d14c8STreehugger Robot// CHECK-NOT: _ZN4TestIiE4doItEi:
30