1// RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data %s -o - | FileCheck %s
2// RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data -coverage-no-function-names-in-data %s -o - | FileCheck %s --check-prefix WITHOUTNAMES
3
4// <rdar://problem/12843084>
5
6int test1(int a) {
7  switch (a % 2) {
8  case 0:
9    ++a;
10  case 1:
11    a /= 2;
12  }
13  return a;
14}
15
16// Check that the noredzone flag is set on the generated functions.
17
18// CHECK: void @__llvm_gcov_indirect_counter_increment(i32* %{{.*}}, i64** %{{.*}}) unnamed_addr [[NRZ:#[0-9]+]]
19
20// Inside llvm_gcov_writeout, check that -coverage-no-function-names-in-data
21// passes null as the function name.
22// CHECK: void @__llvm_gcov_writeout() unnamed_addr [[NRZ]]
23// CHECK: call void @llvm_gcda_emit_function({{.*}}, i8* getelementptr {{.*}}, {{.*}})
24// WITHOUTNAMES: void @__llvm_gcov_writeout() unnamed_addr
25// WITHOUTNAMES: call void @llvm_gcda_emit_function({{.*}}, i8* null, {{.*}})
26
27// CHECK: void @__llvm_gcov_flush() unnamed_addr [[NRZ]]
28// CHECK: void @__llvm_gcov_init() unnamed_addr [[NRZ]]
29
30// CHECK: attributes [[NRZ]] = { {{.*}}noredzone{{.*}} }
31