brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · ca6b3bf Raw
56 lines · cpp
1// RUN: %clangxx_cfi %debug_info_flags -fsanitize-stats -o %t %s2// RUN: env SANITIZER_STATS_PATH=%t.stats %run %t3// RUN: sanstats %t.stats | FileCheck %s4 5// FIXME: We currently emit the wrong debug info under devirtualization.6// UNSUPPORTED: devirt7 8// FIXME: %t.stats must be transferred from device to host for this to work on Android.9// XFAIL: android10 11struct ABase {};12 13struct A : ABase {14  virtual void vf() {}15  void nvf() {}16};17 18extern "C" __attribute__((noinline)) void vcall(A *a) {19  // CHECK: stats.cpp:[[@LINE+1]] {{_?}}vcall cfi-vcall 3720  a->vf();21}22 23extern "C" __attribute__((noinline)) void nvcall(A *a) {24  // CHECK: stats.cpp:[[@LINE+1]] {{_?}}nvcall cfi-nvcall 5125  a->nvf();26}27 28extern "C" __attribute__((noinline)) A *dcast(A *a) {29  // CHECK: stats.cpp:[[@LINE+1]] {{_?}}dcast cfi-derived-cast 2430  return (A *)(ABase *)a;31}32 33extern "C" __attribute__((noinline)) A *ucast(A *a) {34  // CHECK: stats.cpp:[[@LINE+1]] {{_?}}ucast cfi-unrelated-cast 8135  return (A *)(char *)a;36}37 38extern "C" __attribute__((noinline)) void unreachable(A *a) {39  // CHECK-NOT: unreachable40  a->vf();41}42 43int main() {44  A a;45  for (unsigned i = 0; i != 37; ++i)46    vcall(&a);47  for (unsigned i = 0; i != 51; ++i)48    nvcall(&a);49  for (unsigned i = 0; i != 24; ++i)50    dcast(&a);51  for (unsigned i = 0; i != 81; ++i)52    ucast(&a);53  for (unsigned i = 0; i != 0; ++i)54    unreachable(&a);55}56