| 1 |
// Tests for instrumentation of C++ constructors and destructors. |
| 2 |
// |
| 3 |
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.11.0 -x c++ %s -o %t -emit-llvm -fprofile-instrument=clang |
| 4 |
// RUN: FileCheck %s -input-file=%t -check-prefix=INSTR |
| 5 |
// RUN: FileCheck %s -input-file=%t -check-prefix=NOINSTR |
| 6 |
|
| 7 |
struct Foo { |
| 8 |
Foo() {} |
| 9 |
Foo(int) {} |
| 10 |
~Foo() {} |
| 11 |
}; |
| 12 |
|
| 13 |
struct Bar : public Foo { |
| 14 |
Bar() {} |
| 15 |
Bar(int x) : Foo(x) {} |
| 16 |
~Bar(); |
| 17 |
}; |
| 18 |
|
| 19 |
struct Baz : virtual public Foo { |
| 20 |
Baz() {} |
| 21 |
Baz(int x) : Foo(x) {} |
| 22 |
~Baz(); |
| 23 |
}; |
| 24 |
|
| 25 |
struct Quux : public Foo { |
| 26 |
Quux(const char *y, ...) : Foo(0) {} |
| 27 |
}; |
| 28 |
|
| 29 |
Foo foo; |
| 30 |
Foo foo2(1); |
| 31 |
Bar bar; |
| 32 |
Baz baz; |
| 33 |
Baz baz2(1); |
| 34 |
Quux qux("fi", "fo", "fum"); |
| 35 |
|
| 36 |
// Profile data for complete constructors and destructors must be absent. |
| 37 |
|
| 38 |
// INSTR: @__profc__ZN3BazC1Ev = |
| 39 |
// INSTR: @__profc__ZN3BazC1Ei = |
| 40 |
// INSTR: @__profc__ZN4QuuxC1EPKcz = |
| 41 |
// INSTR: @__profc_main = |
| 42 |
// INSTR: @__profc__ZN3FooC2Ev = |
| 43 |
// INSTR: @__profc__ZN3FooD2Ev = |
| 44 |
// INSTR: @__profc__ZN3FooC2Ei = |
| 45 |
// INSTR: @__profc__ZN3BarC2Ev = |
| 46 |
|
| 47 |
// NOINSTR-NOT: @__profc__ZN3FooC1Ev |
| 48 |
// NOINSTR-NOT: @__profc__ZN3FooC1Ei |
| 49 |
// NOINSTR-NOT: @__profc__ZN3FooD1Ev |
| 50 |
// NOINSTR-NOT: @__profc__ZN3BarC1Ev |
| 51 |
// NOINSTR-NOT: @__profc__ZN3BarD1Ev |
| 52 |
// NOINSTR-NOT: @__profc__ZN3FooD1Ev |
| 53 |
|
| 54 |
int main() { |
| 55 |
} |