[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Profile / cxx-stmt-initializers.cpp
blob8efc750e84dcd876e05d812f9233808c4053499c
1 // Tests for instrumentation of C++17 statement initializers
3 // RUN: %clang_cc1 -no-opaque-pointers -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
6 // PGOGEN: @[[SIC:__profc__Z11switch_initv]] = {{(private|internal)}} global [3 x i64] zeroinitializer
7 // PGOGEN: @[[IIC:__profc__Z7if_initv]] = {{(private|internal)}} global [3 x i64] zeroinitializer
9 // Note: We expect counters for the function entry block, the condition in the
10 // switch initializer, and the switch successor block.
12 // CHECK-LABEL: define {{.*}}void @_Z11switch_initv()
13 // PGOGEN: store {{.*}} @[[SIC]], i32 0, i32 0
14 void switch_init() {
15 switch (int i = true ? 0 : 1; i) {}
16 // PGOGEN: store {{.*}} @[[SIC]], i32 0, i32 2
17 // PGOGEN: store {{.*}} @[[SIC]], i32 0, i32 1
20 // Note: We expect counters for the function entry block, the condition in the
21 // if initializer, and the if successor block.
23 // CHECK-LABEL: define {{.*}}void @_Z7if_initv()
24 // PGOGEN: store {{.*}} @[[IIC]], i32 0, i32 0
25 void if_init() {
26 if (int i = true ? 0 : 1; i) {}
27 // PGOGEN: store {{.*}} @[[IIC]], i32 0, i32 2
28 // PGOGEN: store {{.*}} @[[IIC]], i32 0, i32 1