attr-used.cpp revision 6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89
1// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s
2
3// <rdar://problem/8684363>: clang++ not respecting __attribute__((used)) on destructors
4struct X0 {
5  // CHECK: define linkonce_odr {{.*}} @_ZN2X0C1Ev
6  __attribute__((used)) X0() {}
7  // CHECK: define linkonce_odr {{.*}} @_ZN2X0D1Ev
8  __attribute__((used)) ~X0() {}
9};
10
11// PR19743: not emitting __attribute__((used)) inline methods in nested classes.
12struct X1 {
13  struct Nested {
14    // CHECK: define linkonce_odr {{.*}} @_ZN2X16Nested1fEv
15    void __attribute__((used)) f() {}
16  };
17};
18