[PATCH] D95075: [hip] Fix `<complex>` compilation on Windows with VS2019.

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 20 12:10:37 PST 2021


hliao updated this revision to Diff 317966.
hliao added a comment.

Fix typo.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95075/new/

https://reviews.llvm.org/D95075

Files:
  clang/lib/Headers/__clang_hip_cmath.h


Index: clang/lib/Headers/__clang_hip_cmath.h
===================================================================
--- clang/lib/Headers/__clang_hip_cmath.h
+++ clang/lib/Headers/__clang_hip_cmath.h
@@ -626,6 +626,13 @@
 
 // Define device-side math functions from <ymath.h> on MSVC.
 #if defined(_MSC_VER)
+
+// Before VS2019, `<ymath.h>` is also included in `<limits>` and other headers.
+// But, from VS2019, it's only included in `<complex>`. Need to include
+// `<ymath.h>` here to ensure C functions declared there won't be markded as
+// `__host__` and `__device__` through `<complex>` wrapper.
+#include <ymath.h>
+
 #if defined(__cplusplus)
 extern "C" {
 #endif // defined(__cplusplus)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95075.317966.patch
Type: text/x-patch
Size: 694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210120/7c8f3dd5/attachment.bin>


More information about the cfe-commits mailing list