From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/CodeGenCXX/mangle-subst-std.cpp | 112 +++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 clang/test/CodeGenCXX/mangle-subst-std.cpp (limited to 'clang/test/CodeGenCXX/mangle-subst-std.cpp') diff --git a/clang/test/CodeGenCXX/mangle-subst-std.cpp b/clang/test/CodeGenCXX/mangle-subst-std.cpp new file mode 100644 index 0000000..04e3e84 --- /dev/null +++ b/clang/test/CodeGenCXX/mangle-subst-std.cpp @@ -0,0 +1,112 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s + +// Check mangling of Vtables, VTTs, and construction vtables that +// involve standard substitutions. + +// CHECK: @_ZTVSd = linkonce_odr unnamed_addr constant +// CHECK: @_ZTTSd = linkonce_odr unnamed_addr constant +// CHECK: @_ZTCSd0_Si = linkonce_odr unnamed_addr constant +// CHECK: @_ZTCSd16_So = linkonce_odr unnamed_addr constant +// CHECK: @_ZTVSo = linkonce_odr unnamed_addr constant +// CHECK: @_ZTTSo = linkonce_odr unnamed_addr constant +// CHECK: @_ZTVSi = linkonce_odr unnamed_addr constant +// CHECK: @_ZTTSi = linkonce_odr unnamed_addr constant + +namespace std { + struct A { A(); }; + + // CHECK: define void @_ZNSt1AC1Ev(%"struct.std::A"* %this) unnamed_addr + // CHECK: define void @_ZNSt1AC2Ev(%"struct.std::A"* %this) unnamed_addr + A::A() { } +}; + +namespace std { + template struct allocator { }; +} + +// CHECK: define void @_Z1fSaIcESaIiE +void f(std::allocator, std::allocator) { } + +namespace std { + template struct basic_string { }; +} + +// CHECK: define void @_Z1fSbIcciE +void f(std::basic_string) { } + +namespace std { + template struct char_traits { }; + + typedef std::basic_string, std::allocator > string; +} + +// CHECK: _Z1fSs +void f(std::string) { } + +namespace std { + template struct basic_ios { + basic_ios(int); + virtual ~basic_ios(); + }; + template > + struct basic_istream : virtual public basic_ios { + basic_istream(int x) : basic_ios(x), stored(x) { } + + int stored; + }; + template > + struct basic_ostream : virtual public basic_ios { + basic_ostream(int x) : basic_ios(x), stored(x) { } + + float stored; + }; + + template > + struct basic_iostream : public basic_istream, + public basic_ostream { + basic_iostream(int x) : basic_istream(x), + basic_ostream(x), + basic_ios(x) { } + }; +} + +// CHECK: _Z1fSi +void f(std::basic_istream >) { } + +// CHECK: _Z1fSo +void f(std::basic_ostream >) { } + +// CHECK: _Z1fSd +void f(std::basic_iostream >) { } + +extern "C++" { +namespace std +{ + typedef void (*terminate_handler) (); + + // CHECK: _ZSt13set_terminatePFvvE + terminate_handler set_terminate(terminate_handler) { return 0; } +} +} + +// Make sure we don't treat the following like std::string +// CHECK: define void @_Z1f12basic_stringIcSt11char_traitsIcESaIcEE +template struct basic_string { }; +typedef basic_string, std::allocator > not_string; +void f(not_string) { } + +// Manglings for instantiations caused by this function are at the +// top of the test. +void create_streams() { + std::basic_iostream bio(17); +} + +// Make sure we don't mangle 'std' as 'St' here. +namespace N { + namespace std { + struct A { void f(); }; + + // CHECK: define void @_ZN1N3std1A1fEv + void A::f() { } + } +} -- cgit v1.2.3