This revision was automatically updated to reflect the committed changes. Closed by commit rL283678: [CUDA] Declare our __device__ math functions in the same inline namespace as… (authored by jlebar).
Changed prior to commit: https://reviews.llvm.org/D24977?vs=72684&id=74052#toc Repository: rL LLVM https://reviews.llvm.org/D24977 Files: cfe/trunk/lib/Headers/__clang_cuda_cmath.h cfe/trunk/lib/Headers/__clang_cuda_math_forward_declares.h Index: cfe/trunk/lib/Headers/__clang_cuda_math_forward_declares.h =================================================================== --- cfe/trunk/lib/Headers/__clang_cuda_math_forward_declares.h +++ cfe/trunk/lib/Headers/__clang_cuda_math_forward_declares.h @@ -185,7 +185,19 @@ __DEVICE__ double trunc(double); __DEVICE__ float trunc(float); +// We need to define these overloads in exactly the namespace our standard +// library uses (including the right inline namespace), otherwise they won't be +// picked up by other functions in the standard library (e.g. functions in +// <complex>). Thus the ugliness below. +#ifdef _LIBCPP_BEGIN_NAMESPACE_STD +_LIBCPP_BEGIN_NAMESPACE_STD +#else namespace std { +#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_VERSION +#endif +#endif + using ::abs; using ::acos; using ::acosh; @@ -259,7 +271,15 @@ using ::tanh; using ::tgamma; using ::trunc; + +#ifdef _LIBCPP_END_NAMESPACE_STD +_LIBCPP_END_NAMESPACE_STD +#else +#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_END_NAMESPACE_VERSION +#endif } // namespace std +#endif #pragma pop_macro("__DEVICE__") Index: cfe/trunk/lib/Headers/__clang_cuda_cmath.h =================================================================== --- cfe/trunk/lib/Headers/__clang_cuda_cmath.h +++ cfe/trunk/lib/Headers/__clang_cuda_cmath.h @@ -316,7 +316,19 @@ return std::scalbn((double)__x, __exp); } +// We need to define these overloads in exactly the namespace our standard +// library uses (including the right inline namespace), otherwise they won't be +// picked up by other functions in the standard library (e.g. functions in +// <complex>). Thus the ugliness below. +#ifdef _LIBCPP_BEGIN_NAMESPACE_STD +_LIBCPP_BEGIN_NAMESPACE_STD +#else namespace std { +#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_VERSION +#endif +#endif + // Pull the new overloads we defined above into namespace std. using ::acos; using ::acosh; @@ -451,7 +463,15 @@ using ::tanhf; using ::tgammaf; using ::truncf; -} + +#ifdef _LIBCPP_END_NAMESPACE_STD +_LIBCPP_END_NAMESPACE_STD +#else +#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_END_NAMESPACE_VERSION +#endif +} // namespace std +#endif #undef __DEVICE__
Index: cfe/trunk/lib/Headers/__clang_cuda_math_forward_declares.h =================================================================== --- cfe/trunk/lib/Headers/__clang_cuda_math_forward_declares.h +++ cfe/trunk/lib/Headers/__clang_cuda_math_forward_declares.h @@ -185,7 +185,19 @@ __DEVICE__ double trunc(double); __DEVICE__ float trunc(float); +// We need to define these overloads in exactly the namespace our standard +// library uses (including the right inline namespace), otherwise they won't be +// picked up by other functions in the standard library (e.g. functions in +// <complex>). Thus the ugliness below. +#ifdef _LIBCPP_BEGIN_NAMESPACE_STD +_LIBCPP_BEGIN_NAMESPACE_STD +#else namespace std { +#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_VERSION +#endif +#endif + using ::abs; using ::acos; using ::acosh; @@ -259,7 +271,15 @@ using ::tanh; using ::tgamma; using ::trunc; + +#ifdef _LIBCPP_END_NAMESPACE_STD +_LIBCPP_END_NAMESPACE_STD +#else +#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_END_NAMESPACE_VERSION +#endif } // namespace std +#endif #pragma pop_macro("__DEVICE__") Index: cfe/trunk/lib/Headers/__clang_cuda_cmath.h =================================================================== --- cfe/trunk/lib/Headers/__clang_cuda_cmath.h +++ cfe/trunk/lib/Headers/__clang_cuda_cmath.h @@ -316,7 +316,19 @@ return std::scalbn((double)__x, __exp); } +// We need to define these overloads in exactly the namespace our standard +// library uses (including the right inline namespace), otherwise they won't be +// picked up by other functions in the standard library (e.g. functions in +// <complex>). Thus the ugliness below. +#ifdef _LIBCPP_BEGIN_NAMESPACE_STD +_LIBCPP_BEGIN_NAMESPACE_STD +#else namespace std { +#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_VERSION +#endif +#endif + // Pull the new overloads we defined above into namespace std. using ::acos; using ::acosh; @@ -451,7 +463,15 @@ using ::tanhf; using ::tgammaf; using ::truncf; -} + +#ifdef _LIBCPP_END_NAMESPACE_STD +_LIBCPP_END_NAMESPACE_STD +#else +#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_END_NAMESPACE_VERSION +#endif +} // namespace std +#endif #undef __DEVICE__
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits