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/weak-external.cpp | 66 +++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 clang/test/CodeGenCXX/weak-external.cpp (limited to 'clang/test/CodeGenCXX/weak-external.cpp') diff --git a/clang/test/CodeGenCXX/weak-external.cpp b/clang/test/CodeGenCXX/weak-external.cpp new file mode 100644 index 0000000..dad54f6 --- /dev/null +++ b/clang/test/CodeGenCXX/weak-external.cpp @@ -0,0 +1,66 @@ +// RUN: %clang -fexceptions %s -S -emit-llvm -o - | FileCheck %s +// PR4262 + +// CHECK-NOT: _ZNSs12_S_constructIPKcEEPcT_S3_RKSaIcESt20forward_iterator_tag + +// The "basic_string" extern template instantiation declaration is supposed to +// suppress the implicit instantiation of non-inline member functions. Make sure +// that we suppress the implicit instantiation of non-inline member functions +// defined out-of-line. That we aren't instantiating the basic_string +// constructor when we shouldn't be. Such an instantiation forces the implicit +// instantiation of _S_construct. Since _S_construct is a member +// template, it's instantiation is *not* suppressed (despite being in +// basic_string), so we would emit it as a weak definition. + +#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) +#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) +#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default"))) +#if (__has_feature(cxx_noexcept)) +# define _NOEXCEPT noexcept +# define _NOEXCEPT_(x) noexcept(x) +#else +# define _NOEXCEPT throw() +# define _NOEXCEPT_(x) +#endif + +namespace std // purposefully not using versioning namespace +{ + +template struct char_traits; +template class allocator; +template , + class _Allocator = allocator<_CharT> > + class _LIBCPP_VISIBLE basic_string; +typedef basic_string, allocator > string; + +class _LIBCPP_EXCEPTION_ABI exception +{ +public: + _LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {} + virtual ~exception() _NOEXCEPT; + virtual const char* what() const _NOEXCEPT; +}; + +class _LIBCPP_EXCEPTION_ABI runtime_error + : public exception +{ +private: + void* __imp_; +public: + explicit runtime_error(const string&); + explicit runtime_error(const char*); + + runtime_error(const runtime_error&) _NOEXCEPT; + runtime_error& operator=(const runtime_error&) _NOEXCEPT; + + virtual ~runtime_error() _NOEXCEPT; + + virtual const char* what() const _NOEXCEPT; +}; + +} + +void dummysymbol() { + throw(std::runtime_error("string")); +} -- cgit v1.2.3