[clang] [CUDA] add wrapper header for libc++'s __utlility/declval.h (PR #148918)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 15 11:47:39 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h -- clang/lib/Headers/cuda_wrappers/__utility/declval.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Headers/cuda_wrappers/__utility/declval.h b/clang/lib/Headers/cuda_wrappers/__utility/declval.h
index b16311e84..a8434e360 100644
--- a/clang/lib/Headers/cuda_wrappers/__utility/declval.h
+++ b/clang/lib/Headers/cuda_wrappers/__utility/declval.h
@@ -11,20 +11,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Suppress deprecation notice for volatile-qualified return type resulting
// from volatile-qualified types _Tp.
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template <class _Tp>
-__attribute__((device))
-_Tp&& __declval(int);
-template <class _Tp>
-__attribute__((device))
-_Tp __declval(long);
+template <class _Tp> __attribute__((device)) _Tp &&__declval(int);
+template <class _Tp> __attribute__((device)) _Tp __declval(long);
_LIBCPP_SUPPRESS_DEPRECATED_POP
template <class _Tp>
-__attribute__((device))
-_LIBCPP_HIDE_FROM_ABI decltype(std::__declval<_Tp>(0)) declval() _NOEXCEPT {
+__attribute__((device)) _LIBCPP_HIDE_FROM_ABI decltype(std::__declval<_Tp>(0))
+declval() _NOEXCEPT {
static_assert(!__is_same(_Tp, _Tp),
"std::declval can only be used in an unevaluated context. "
- "It's likely that your current usage is trying to extract a value from the function.");
+ "It's likely that your current usage is trying to extract a "
+ "value from the function.");
}
_LIBCPP_END_NAMESPACE_STD
``````````
</details>
https://github.com/llvm/llvm-project/pull/148918
More information about the cfe-commits
mailing list