[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Profile / cxx-stmt-initializers.cpp
bloba02be89c8e14d5a2df2c4f3b4650008ef1e77b47
1 // Tests for instrumentation of C++17 statement initializers
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
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]]
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]]
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