[libcxx] r198698 - Replace casts of __impl_ with the correct reinterpret_cast of the
Joerg Sonnenberger
joerg at bec.de
Tue Jan 7 11:21:14 PST 2014
Author: joerg
Date: Tue Jan 7 13:21:13 2014
New Revision: 198698
URL: http://llvm.org/viewvc/llvm-project?rev=198698&view=rev
Log:
Replace casts of __impl_ with the correct reinterpret_cast of the
address. Restores the assembly of before r198504.
Modified:
libcxx/trunk/src/stdexcept.cpp
Modified: libcxx/trunk/src/stdexcept.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/stdexcept.cpp?rev=198698&r1=198697&r2=198698&view=diff
==============================================================================
--- libcxx/trunk/src/stdexcept.cpp (original)
+++ libcxx/trunk/src/stdexcept.cpp Tue Jan 7 13:21:13 2014
@@ -102,28 +102,28 @@ namespace std // purposefully not using
logic_error::logic_error(const string& msg)
{
- __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
+ __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
::new(s) __libcpp_nmstr(msg.c_str());
}
logic_error::logic_error(const char* msg)
{
- __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
+ __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
::new(s) __libcpp_nmstr(msg);
}
logic_error::logic_error(const logic_error& le) _NOEXCEPT
{
- __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
- const __libcpp_nmstr *s2 = static_cast<const __libcpp_nmstr *>(le.__imp_);
+ __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
+ const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_);
::new(s) __libcpp_nmstr(*s2);
}
logic_error&
logic_error::operator=(const logic_error& le) _NOEXCEPT
{
- __libcpp_nmstr *s1 = static_cast<__libcpp_nmstr *>(__imp_);
- const __libcpp_nmstr *s2 = static_cast<const __libcpp_nmstr *>(le.__imp_);
+ __libcpp_nmstr *s1 = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
+ const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_);
*s1 = *s2;
return *this;
}
@@ -132,14 +132,14 @@ logic_error::operator=(const logic_error
logic_error::~logic_error() _NOEXCEPT
{
- __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
+ __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
s->~__libcpp_nmstr();
}
const char*
logic_error::what() const _NOEXCEPT
{
- __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
+ const __libcpp_nmstr *s = reinterpret_cast<const __libcpp_nmstr *>(&__imp_);
return s->c_str();
}
@@ -147,28 +147,28 @@ logic_error::what() const _NOEXCEPT
runtime_error::runtime_error(const string& msg)
{
- __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
+ __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
::new(s) __libcpp_nmstr(msg.c_str());
}
runtime_error::runtime_error(const char* msg)
{
- __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
+ __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
::new(s) __libcpp_nmstr(msg);
}
runtime_error::runtime_error(const runtime_error& le) _NOEXCEPT
{
- __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
- const __libcpp_nmstr *s2 = static_cast<const __libcpp_nmstr *>(le.__imp_);
+ __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
+ const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_);
::new(s) __libcpp_nmstr(*s2);
}
runtime_error&
runtime_error::operator=(const runtime_error& le) _NOEXCEPT
{
- __libcpp_nmstr *s1 = static_cast<__libcpp_nmstr *>(__imp_);
- const __libcpp_nmstr *s2 = static_cast<const __libcpp_nmstr *>(le.__imp_);
+ __libcpp_nmstr *s1 = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
+ const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_);
*s1 = *s2;
return *this;
}
@@ -177,14 +177,14 @@ runtime_error::operator=(const runtime_e
runtime_error::~runtime_error() _NOEXCEPT
{
- __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
+ __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
s->~__libcpp_nmstr();
}
const char*
runtime_error::what() const _NOEXCEPT
{
- __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
+ const __libcpp_nmstr *s = reinterpret_cast<const __libcpp_nmstr *>(&__imp_);
return s->c_str();
}
More information about the cfe-commits
mailing list