unused_names.c 888 B

12345678910111213141516171819202122232425262728
  1. // RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -emit-llvm -main-file-name unused_names.c -o - %s > %t
  2. // RUN: FileCheck -input-file %t %s
  3. // RUN: FileCheck -check-prefix=SYSHEADER -input-file %t %s
  4. // Since foo is never emitted, there should not be a profile name for it.
  5. // CHECK-DAG: @__llvm_profile_name_bar = {{.*}} [3 x i8] c"bar", section "{{.*}}__llvm_prf_names"
  6. // CHECK-DAG: @__llvm_profile_name_baz = {{.*}} [3 x i8] c"baz", section "{{.*}}__llvm_prf_names"
  7. // CHECK-DAG: @"__llvm_profile_name_unused_names.c:qux" = {{.*}} [18 x i8] c"unused_names.c:qux", section "{{.*}}__llvm_prf_names"
  8. // SYSHEADER-NOT: @__llvm_profile_name_foo =
  9. #ifdef IS_SYSHEADER
  10. #pragma clang system_header
  11. inline int foo() { return 0; }
  12. #else
  13. #define IS_SYSHEADER
  14. #include __FILE__
  15. int bar() { return 0; }
  16. inline int baz() { return 0; }
  17. static int qux() { return 42; }
  18. #endif