[llvm-branch-commits] [clang] 7b5d7c7 - [hip] Fix `<complex>` compilation on Windows with VS2019.

Michael Liao via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 20 13:48:31 PST 2021


Author: Michael Liao
Date: 2021-01-20T16:43:44-05:00
New Revision: 7b5d7c7b0a2479de007ad18b947459b799991667

URL: https://github.com/llvm/llvm-project/commit/7b5d7c7b0a2479de007ad18b947459b799991667
DIFF: https://github.com/llvm/llvm-project/commit/7b5d7c7b0a2479de007ad18b947459b799991667.diff

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

Differential Revision: https://reviews.llvm.org/D95075

Added: 
    

Modified: 
    clang/lib/Headers/__clang_hip_cmath.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/__clang_hip_cmath.h b/clang/lib/Headers/__clang_hip_cmath.h
index 128d64e271b8..cd22a2df954b 100644
--- a/clang/lib/Headers/__clang_hip_cmath.h
+++ b/clang/lib/Headers/__clang_hip_cmath.h
@@ -626,6 +626,13 @@ _GLIBCXX_END_NAMESPACE_VERSION
 
 // 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)


        


More information about the llvm-branch-commits mailing list