Hans Wennborg | c9bd88e | 2014-01-14 19:35:09 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s |
Douglas Gregor | e061015 | 2011-02-15 18:11:42 +0000 | [diff] [blame] | 2 | |
| 3 | // <rdar://problem/8684363>: clang++ not respecting __attribute__((used)) on destructors |
| 4 | struct X0 { |
Richard Smith | 1ba0a07 | 2014-08-01 20:39:36 +0000 | [diff] [blame] | 5 | // CHECK-DAG: define linkonce_odr {{.*}} @_ZN2X0C1Ev |
Douglas Gregor | e061015 | 2011-02-15 18:11:42 +0000 | [diff] [blame] | 6 | __attribute__((used)) X0() {} |
Richard Smith | 1ba0a07 | 2014-08-01 20:39:36 +0000 | [diff] [blame] | 7 | // CHECK-DAG: define linkonce_odr {{.*}} @_ZN2X0D1Ev |
Douglas Gregor | e061015 | 2011-02-15 18:11:42 +0000 | [diff] [blame] | 8 | __attribute__((used)) ~X0() {} |
| 9 | }; |
Hans Wennborg | a926d84 | 2014-05-23 20:37:38 +0000 | [diff] [blame] | 10 | |
| 11 | // PR19743: not emitting __attribute__((used)) inline methods in nested classes. |
| 12 | struct X1 { |
| 13 | struct Nested { |
Richard Smith | 1ba0a07 | 2014-08-01 20:39:36 +0000 | [diff] [blame] | 14 | // CHECK-DAG: define linkonce_odr {{.*}} @_ZN2X16Nested1fEv |
Hans Wennborg | a926d84 | 2014-05-23 20:37:38 +0000 | [diff] [blame] | 15 | void __attribute__((used)) f() {} |
| 16 | }; |
| 17 | }; |
Hans Wennborg | dfcb7d6 | 2014-06-06 17:36:17 +0000 | [diff] [blame] | 18 | |
| 19 | struct X2 { |
| 20 | // We must delay emission of bar() until foo() has had its body parsed, |
| 21 | // otherwise foo() would not be emitted. |
| 22 | void __attribute__((used)) bar() { foo(); } |
| 23 | void foo() { } |
| 24 | |
Richard Smith | 1ba0a07 | 2014-08-01 20:39:36 +0000 | [diff] [blame] | 25 | // CHECK-DAG: define linkonce_odr {{.*}} @_ZN2X23barEv |
| 26 | // CHECK-DAG: define linkonce_odr {{.*}} @_ZN2X23fooEv |
Hans Wennborg | dfcb7d6 | 2014-06-06 17:36:17 +0000 | [diff] [blame] | 27 | }; |