]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Profile/cxx-stmt-initializers.cpp
Vendor import of clang trunk r306956:
[FreeBSD/FreeBSD.git] / test / Profile / cxx-stmt-initializers.cpp
1 // Tests for instrumentation of C++17 statement initializers
2
3 // RUN: %clang_cc1 -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-stmt-initializers.cpp -std=c++1z -o - -emit-llvm -fprofile-instrument=clang > %tgen
4 // RUN: FileCheck --input-file=%tgen -check-prefix=CHECK -check-prefix=PGOGEN %s
5
6 // PGOGEN: @[[SIC:__profc__Z11switch_initv]] = private global [3 x i64] zeroinitializer
7 // PGOGEN: @[[IIC:__profc__Z7if_initv]] = private global [3 x i64] zeroinitializer
8
9 // Note: We expect counters for the function entry block, the condition in the
10 // switch initializer, and the switch successor block.
11 //
12 // CHECK-LABEL: define {{.*}}void @_Z11switch_initv()
13 // PGOGEN: store {{.*}} @[[SIC]], i64 0, i64 0
14 void switch_init() {
15   switch (int i = true ? 0 : 1; i) {}
16   // PGOGEN: store {{.*}} @[[SIC]], i64 0, i64 2
17   // PGOGEN: store {{.*}} @[[SIC]], i64 0, i64 1
18 }
19
20 // Note: We expect counters for the function entry block, the condition in the
21 // if initializer, and the if successor block.
22 //
23 // CHECK-LABEL: define {{.*}}void @_Z7if_initv()
24 // PGOGEN: store {{.*}} @[[IIC]], i64 0, i64 0
25 void if_init() {
26   if (int i = true ? 0 : 1; i) {}
27   // PGOGEN: store {{.*}} @[[IIC]], i64 0, i64 2
28   // PGOGEN: store {{.*}} @[[IIC]], i64 0, i64 1
29 }