1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s 2f4a2713aSLionel Sambuc 3f4a2713aSLionel Sambuc // <rdar://problem/8684363>: clang++ not respecting __attribute__((used)) on destructors 4f4a2713aSLionel Sambuc struct X0 { 5*0a6a1f1dSLionel Sambuc // CHECK-DAG: define linkonce_odr {{.*}} @_ZN2X0C1Ev X0X06f4a2713aSLionel Sambuc __attribute__((used)) X0() {} 7*0a6a1f1dSLionel Sambuc // CHECK-DAG: define linkonce_odr {{.*}} @_ZN2X0D1Ev ~X0X08f4a2713aSLionel Sambuc __attribute__((used)) ~X0() {} 9f4a2713aSLionel Sambuc }; 10*0a6a1f1dSLionel Sambuc 11*0a6a1f1dSLionel Sambuc // PR19743: not emitting __attribute__((used)) inline methods in nested classes. 12*0a6a1f1dSLionel Sambuc struct X1 { 13*0a6a1f1dSLionel Sambuc struct Nested { 14*0a6a1f1dSLionel Sambuc // CHECK-DAG: define linkonce_odr {{.*}} @_ZN2X16Nested1fEv fX1::Nested15*0a6a1f1dSLionel Sambuc void __attribute__((used)) f() {} 16*0a6a1f1dSLionel Sambuc }; 17*0a6a1f1dSLionel Sambuc }; 18*0a6a1f1dSLionel Sambuc 19*0a6a1f1dSLionel Sambuc struct X2 { 20*0a6a1f1dSLionel Sambuc // We must delay emission of bar() until foo() has had its body parsed, 21*0a6a1f1dSLionel Sambuc // otherwise foo() would not be emitted. barX222*0a6a1f1dSLionel Sambuc void __attribute__((used)) bar() { foo(); } fooX223*0a6a1f1dSLionel Sambuc void foo() { } 24*0a6a1f1dSLionel Sambuc 25*0a6a1f1dSLionel Sambuc // CHECK-DAG: define linkonce_odr {{.*}} @_ZN2X23barEv 26*0a6a1f1dSLionel Sambuc // CHECK-DAG: define linkonce_odr {{.*}} @_ZN2X23fooEv 27*0a6a1f1dSLionel Sambuc }; 28