brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 1f9412f Raw
36 lines · c
1/// Test that destructors and destructors whose priorities are greater than 100 are tracked.2// XFAIL: target={{.*haiku.*}}3// RUN: mkdir -p %t.dir && cd %t.dir4// RUN: %clang --coverage %s -o %t -dumpdir ./5// RUN: rm -f gcov-destructor.gcda && %run %t6// RUN: llvm-cov gcov -t gcov-destructor.gcda | FileCheck %s7// UNSUPPORTED: darwin8 9#include <unistd.h>10 11void before_exec() {}                   // CHECK:      1: [[#@LINE]]:void before_exec12void after_exec() {}                    // CHECK-NEXT: 1: [[#@LINE]]:void after_exec13 14__attribute__((constructor))            // CHECK:      -: [[#@LINE]]:__attribute__15void constructor() {}                   // CHECK-NEXT: 1: [[#@LINE]]:16 17/// Runs before __llvm_gcov_writeout.18__attribute__((destructor))             // CHECK:      -: [[#@LINE]]:__attribute__19void destructor() {}                    // CHECK-NEXT: 1: [[#@LINE]]:20 21__attribute__((destructor(101)))        // CHECK:      -: [[#@LINE]]:__attribute__22void destructor_101() {}                // CHECK-NEXT: 1: [[#@LINE]]:23 24/// Runs after __llvm_gcov_writeout.25__attribute__((destructor(99)))         // CHECK:      -: [[#@LINE]]:__attribute__26void destructor_99() {}                 // CHECK-NEXT: #####: [[#@LINE]]:27 28int main() {29  before_exec();30  // Implicit writeout.31  execl("/not_exist", "not_exist", (char *)0);32  // Still tracked.33  after_exec();34  return 0;35}36