[libc++] Fix modules build - Rework __refstring definition
Summary: `__libcpp_refstring` currently has two different definitions. First there is the complete definition in `<__refstring>` but there is also a second in `<stdexcept>`. The historical reason for this split is because both libc++ and libc++abi need to see the inline definitions of __libcpp_refstrings methods, but the `<stdexcept>` header doesn't. However this is an ODR violation and breaks the modules build. This patch fixes the issue by creating a single class definition in `<stdexcept>` and changing `<__refstring>` to contain only the inline method definitions. This way both `libcxx/src/stdexcept.cpp` and `libcxxabi/src/stdexcept.cpp` see the same declaration in `<stdexcept>` and definitions in `<__refstring>` Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25603 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285100 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -53,17 +53,23 @@ public:
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP___REFSTRING
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
class _LIBCPP_HIDDEN __libcpp_refstring {
|
||||
#ifdef __clang__
|
||||
const char *__imp_ __attribute__((__unused__)); // only clang emits a warning
|
||||
#else
|
||||
const char *__imp_;
|
||||
#endif
|
||||
|
||||
class _LIBCPP_HIDDEN __libcpp_refstring
|
||||
{
|
||||
const char* __imp_;
|
||||
|
||||
bool __uses_refcount() const;
|
||||
public:
|
||||
explicit __libcpp_refstring(const char* msg);
|
||||
__libcpp_refstring(const __libcpp_refstring& s) _NOEXCEPT;
|
||||
__libcpp_refstring& operator=(const __libcpp_refstring& s) _NOEXCEPT;
|
||||
~__libcpp_refstring();
|
||||
|
||||
const char* c_str() const _NOEXCEPT {return __imp_;}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
#endif
|
||||
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user