2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
|
2009-09-27 04:53:44 +08:00
|
|
|
|
2010-05-26 13:11:13 +08:00
|
|
|
// Check mangling of Vtables, VTTs, and construction vtables that
|
|
|
|
// involve standard substitutions.
|
|
|
|
|
2015-01-22 08:24:57 +08:00
|
|
|
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK: @_ZTVSd = linkonce_odr unnamed_addr constant
|
2011-09-26 09:56:36 +08:00
|
|
|
// CHECK: @_ZTTSd = linkonce_odr unnamed_addr constant
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK: @_ZTCSd0_Si = linkonce_odr unnamed_addr constant
|
2011-03-27 17:00:25 +08:00
|
|
|
// CHECK: @_ZTCSd16_So = linkonce_odr unnamed_addr constant
|
2011-01-30 03:16:51 +08:00
|
|
|
// CHECK: @_ZTVSi = linkonce_odr unnamed_addr constant
|
2011-09-26 09:56:36 +08:00
|
|
|
// CHECK: @_ZTTSi = linkonce_odr unnamed_addr constant
|
2015-01-22 08:24:57 +08:00
|
|
|
// CHECK: @_ZTVSo = linkonce_odr unnamed_addr constant
|
|
|
|
// CHECK: @_ZTTSo = linkonce_odr unnamed_addr constant
|
2011-05-16 12:08:36 +08:00
|
|
|
|
2009-09-27 04:53:44 +08:00
|
|
|
namespace std {
|
|
|
|
struct A { A(); };
|
2018-10-15 23:43:00 +08:00
|
|
|
|
|
|
|
// CHECK-LABEL: define void @_ZNSt1AC2Ev(%"struct.std::A"* %this) unnamed_addr
|
|
|
|
// CHECK-LABEL: define void @_ZNSt1AC1Ev(%"struct.std::A"* %this) unnamed_addr
|
2009-09-27 04:53:44 +08:00
|
|
|
A::A() { }
|
|
|
|
};
|
2009-09-27 07:10:05 +08:00
|
|
|
|
|
|
|
namespace std {
|
2009-10-09 01:20:26 +08:00
|
|
|
template<typename> struct allocator { };
|
2009-09-27 07:10:05 +08:00
|
|
|
}
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z1fSaIcESaIiE
|
2009-09-29 13:36:21 +08:00
|
|
|
void f(std::allocator<char>, std::allocator<int>) { }
|
2009-09-27 07:14:39 +08:00
|
|
|
|
|
|
|
namespace std {
|
2009-10-09 01:20:26 +08:00
|
|
|
template<typename, typename, typename> struct basic_string { };
|
2009-09-27 07:14:39 +08:00
|
|
|
}
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z1fSbIcciE
|
2009-09-29 13:36:21 +08:00
|
|
|
void f(std::basic_string<char, char, int>) { }
|
2009-09-27 08:12:57 +08:00
|
|
|
|
|
|
|
namespace std {
|
2009-10-09 01:20:26 +08:00
|
|
|
template<typename> struct char_traits { };
|
2018-10-15 23:43:00 +08:00
|
|
|
|
2009-09-27 08:12:57 +08:00
|
|
|
typedef std::basic_string<char, std::char_traits<char>, std::allocator<char> > string;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: _Z1fSs
|
|
|
|
void f(std::string) { }
|
2009-10-09 01:20:26 +08:00
|
|
|
|
|
|
|
namespace std {
|
2018-10-15 23:43:00 +08:00
|
|
|
template<typename, typename> struct basic_ios {
|
2010-05-26 13:11:13 +08:00
|
|
|
basic_ios(int);
|
|
|
|
virtual ~basic_ios();
|
|
|
|
};
|
2018-10-15 23:43:00 +08:00
|
|
|
template<typename charT, typename traits = char_traits<charT> >
|
|
|
|
struct basic_istream : virtual public basic_ios<charT, traits> {
|
2010-05-26 13:11:13 +08:00
|
|
|
basic_istream(int x) : basic_ios<charT, traits>(x), stored(x) { }
|
|
|
|
|
|
|
|
int stored;
|
|
|
|
};
|
2018-10-15 23:43:00 +08:00
|
|
|
template<typename charT, typename traits = char_traits<charT> >
|
|
|
|
struct basic_ostream : virtual public basic_ios<charT, traits> {
|
2010-05-26 13:11:13 +08:00
|
|
|
basic_ostream(int x) : basic_ios<charT, traits>(x), stored(x) { }
|
|
|
|
|
|
|
|
float stored;
|
|
|
|
};
|
|
|
|
|
2018-10-15 23:43:00 +08:00
|
|
|
template<typename charT, typename traits = char_traits<charT> >
|
|
|
|
struct basic_iostream : public basic_istream<charT, traits>,
|
|
|
|
public basic_ostream<charT, traits> {
|
2010-05-26 13:11:13 +08:00
|
|
|
basic_iostream(int x) : basic_istream<charT, traits>(x),
|
|
|
|
basic_ostream<charT, traits>(x),
|
|
|
|
basic_ios<charT, traits>(x) { }
|
|
|
|
};
|
2009-10-09 01:20:26 +08:00
|
|
|
}
|
|
|
|
|
2009-12-08 03:56:42 +08:00
|
|
|
// CHECK: _Z1fSi
|
|
|
|
void f(std::basic_istream<char, std::char_traits<char> >) { }
|
|
|
|
|
2009-10-09 01:20:26 +08:00
|
|
|
// CHECK: _Z1fSo
|
|
|
|
void f(std::basic_ostream<char, std::char_traits<char> >) { }
|
2009-12-04 14:23:23 +08:00
|
|
|
|
2009-12-08 03:56:42 +08:00
|
|
|
// CHECK: _Z1fSd
|
|
|
|
void f(std::basic_iostream<char, std::char_traits<char> >) { }
|
|
|
|
|
2009-12-04 14:23:23 +08:00
|
|
|
extern "C++" {
|
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
typedef void (*terminate_handler) ();
|
2018-10-15 23:43:00 +08:00
|
|
|
|
2009-12-04 14:23:23 +08:00
|
|
|
// CHECK: _ZSt13set_terminatePFvvE
|
|
|
|
terminate_handler set_terminate(terminate_handler) { return 0; }
|
|
|
|
}
|
|
|
|
}
|
2010-02-24 02:20:18 +08:00
|
|
|
|
|
|
|
// Make sure we don't treat the following like std::string
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z1f12basic_stringIcSt11char_traitsIcESaIcEE
|
2010-02-24 02:20:18 +08:00
|
|
|
template<typename, typename, typename> struct basic_string { };
|
|
|
|
typedef basic_string<char, std::char_traits<char>, std::allocator<char> > not_string;
|
|
|
|
void f(not_string) { }
|
2010-05-26 13:11:13 +08:00
|
|
|
|
|
|
|
// Manglings for instantiations caused by this function are at the
|
|
|
|
// top of the test.
|
|
|
|
void create_streams() {
|
|
|
|
std::basic_iostream<char> bio(17);
|
|
|
|
}
|
2010-06-02 23:58:27 +08:00
|
|
|
|
|
|
|
// Make sure we don't mangle 'std' as 'St' here.
|
|
|
|
namespace N {
|
|
|
|
namespace std {
|
|
|
|
struct A { void f(); };
|
2018-10-15 23:43:00 +08:00
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_ZN1N3std1A1fEv
|
2010-06-02 23:58:27 +08:00
|
|
|
void A::f() { }
|
|
|
|
}
|
|
|
|
}
|