[clang] [CUDA][HIP] Add a __device__ version of std::__glibcxx_assert_fail() (PR #136133)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 29 07:52:03 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/bits/c++config.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Headers/cuda_wrappers/bits/c++config.h b/clang/lib/Headers/cuda_wrappers/bits/c++config.h
index 08ef9c274..eafa13a9c 100644
--- a/clang/lib/Headers/cuda_wrappers/bits/c++config.h
+++ b/clang/lib/Headers/cuda_wrappers/bits/c++config.h
@@ -21,22 +21,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
 
 #ifdef _GLIBCXX_VERBOSE_ASSERT
-__attribute__((device, noreturn))
-inline void
-__glibcxx_assert_fail(
-        const char* file, int line,
-        const char* function, const char* condition) noexcept {
-    if (file && function && condition)
-      __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", file, line, function, condition);
-    else if (function)
-      __builtin_printf("%s: Undefined behavior detected.\n", function);
-    __builtin_abort();
+__attribute__((device, noreturn)) inline void
+__glibcxx_assert_fail(const char *file, int line, const char *function,
+                      const char *condition) noexcept {
+  if (file && function && condition)
+    __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", file, line,
+                     function, condition);
+  else if (function)
+    __builtin_printf("%s: Undefined behavior detected.\n", function);
+  __builtin_abort();
 }
 #endif
 
 #endif
-__attribute__((device, noreturn, __always_inline__, __visibility__("default")))
-inline void
+__attribute__((device, noreturn, __always_inline__,
+               __visibility__("default"))) inline void
 __glibcxx_assert_fail(...) noexcept {
   __builtin_abort();
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/136133


More information about the cfe-commits mailing list