30 lines · cpp
1// Tests for instrumentation of C++17 statement initializers2 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 > %tgen4// RUN: FileCheck --input-file=%tgen -check-prefix=CHECK -check-prefix=PGOGEN %s5 6// PGOGEN: @[[SIC:__profc__Z11switch_initv]] = {{(private|internal)}} global [3 x i64] zeroinitializer7// PGOGEN: @[[IIC:__profc__Z7if_initv]] = {{(private|internal)}} global [3 x i64] zeroinitializer8 9// Note: We expect counters for the function entry block, the condition in the10// switch initializer, and the switch successor block.11//12// CHECK-LABEL: define {{.*}}void @_Z11switch_initv()13// PGOGEN: store {{.*}} @[[SIC]]14void switch_init() {15 switch (int i = true ? 0 : 1; i) {}16 // PGOGEN: store {{.*}} @[[SIC]], i32 0, i32 217 // PGOGEN: store {{.*}} @[[SIC]], i32 0, i32 118}19 20// Note: We expect counters for the function entry block, the condition in the21// if initializer, and the if successor block.22//23// CHECK-LABEL: define {{.*}}void @_Z7if_initv()24// PGOGEN: store {{.*}} @[[IIC]]25void if_init() {26 if (int i = true ? 0 : 1; i) {}27 // PGOGEN: store {{.*}} @[[IIC]], i32 0, i32 228 // PGOGEN: store {{.*}} @[[IIC]], i32 0, i32 129}30