[clang] [Clang][HIP] Include `__clang_cuda_math_forward_declares.h` before `<cmath>` (PR #201563)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 4 05:24:37 PDT 2026


Juan Manuel Martinez =?utf-8?q?CaamaƱo?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/201563 at github.com>


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 origin/main HEAD --extensions h -- clang/lib/Headers/__clang_hip_runtime_wrapper.h --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/clang/lib/Headers/__clang_hip_runtime_wrapper.h b/clang/lib/Headers/__clang_hip_runtime_wrapper.h
index 72494fdda..4b8cffd86 100644
--- a/clang/lib/Headers/__clang_hip_runtime_wrapper.h
+++ b/clang/lib/Headers/__clang_hip_runtime_wrapper.h
@@ -112,8 +112,10 @@ __attribute__((weak)) inline __device__ void free(void *__ptr) {
 
 #if !defined(__HIPCC_RTC__)
 // We must include the forward declarations before cmath is included.
-// Otherwise `constexpr` functions in <cmath> would be implicitely __host__ __device__.
-// Declaring the __device__ verison before allows us to overload them with __device__ versions (this behavour is only valid for system headers).
+// Otherwise `constexpr` functions in <cmath> would be implicitely __host__
+// __device__. Declaring the __device__ verison before allows us to overload
+// them with __device__ versions (this behavour is only valid for system
+// headers).
 #include <__clang_cuda_math_forward_declares.h>
 #include <cmath>
 #include <cstdlib>

``````````

</details>


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


More information about the cfe-commits mailing list