Rong Xu | 9837ef5 | 2016-02-04 18:39:09 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -main-file-name unused_names.c -o - %s > %t |
Justin Bogner | 2368c82 | 2015-02-11 02:53:03 +0000 | [diff] [blame] | 2 | // RUN: FileCheck -input-file %t %s |
| 3 | // RUN: FileCheck -check-prefix=SYSHEADER -input-file %t %s |
Justin Bogner | 00270df | 2015-01-22 02:17:23 +0000 | [diff] [blame] | 4 | |
Vedant Kumar | 9503004 | 2017-02-14 20:03:56 +0000 | [diff] [blame] | 5 | // CHECK-DAG: @__profc_bar |
Reid Kleckner | 5bbdfeac | 2019-02-10 20:17:07 +0000 | [diff] [blame] | 6 | // CHECK-DAG: @__llvm_prf_nm = private constant {{.*}}, section "{{.*__llvm_prf_names|\.lprfn\$M}}" |
Justin Bogner | 2368c82 | 2015-02-11 02:53:03 +0000 | [diff] [blame] | 7 | |
Vedant Kumar | 9503004 | 2017-02-14 20:03:56 +0000 | [diff] [blame] | 8 | // These are never instantiated, so we shouldn't get counters for them. |
| 9 | // |
| 10 | // CHECK-NOT: @__profc_baz |
| 11 | // CHECK-NOT: @__profc_unused_names.c_qux |
| 12 | |
| 13 | // SYSHEADER-NOT: @__profc_foo = |
Justin Bogner | 2368c82 | 2015-02-11 02:53:03 +0000 | [diff] [blame] | 14 | |
Justin Bogner | 00270df | 2015-01-22 02:17:23 +0000 | [diff] [blame] | 15 | |
| 16 | #ifdef IS_SYSHEADER |
| 17 | |
| 18 | #pragma clang system_header |
| 19 | inline int foo() { return 0; } |
| 20 | |
| 21 | #else |
| 22 | |
| 23 | #define IS_SYSHEADER |
| 24 | #include __FILE__ |
| 25 | |
| 26 | int bar() { return 0; } |
Justin Bogner | 2368c82 | 2015-02-11 02:53:03 +0000 | [diff] [blame] | 27 | inline int baz() { return 0; } |
| 28 | static int qux() { return 42; } |
Justin Bogner | 00270df | 2015-01-22 02:17:23 +0000 | [diff] [blame] | 29 | |
| 30 | #endif |