[llvm] c0ef1ff - [Build][NFC] Fixes for building on Windows with libc++

Andrew Ng via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 1 07:42:12 PDT 2022


Author: Andrew Ng
Date: 2022-07-01T15:37:57+01:00
New Revision: c0ef1ffc9e2fdf070a016582228e2b854fb35594

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

LOG: [Build][NFC] Fixes for building on Windows with libc++

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

Added: 
    

Modified: 
    llvm/include/llvm/Support/RWMutex.h
    llvm/lib/Support/NativeFormatting.cpp
    llvm/tools/llvm-exegesis/lib/X86/Target.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/RWMutex.h b/llvm/include/llvm/Support/RWMutex.h
index 33a5d3efffeea..3dd962586c366 100644
--- a/llvm/include/llvm/Support/RWMutex.h
+++ b/llvm/include/llvm/Support/RWMutex.h
@@ -93,8 +93,8 @@ class RWMutexImpl {
 /// running in multithreaded mode.
 template <bool mt_only> class SmartRWMutex {
   // shared_mutex (C++17) is more efficient than shared_timed_mutex (C++14)
-  // on Windows and always available on MSVC.
-#if defined(_MSC_VER) || __cplusplus > 201402L
+  // on Windows and always available on MSVC except with libc++.
+#if (defined(_MSC_VER) && !defined(_LIBCPP_VERSION)) || __cplusplus > 201402L
   std::shared_mutex impl;
 #else
 #if !defined(LLVM_USE_RW_MUTEX_IMPL)

diff  --git a/llvm/lib/Support/NativeFormatting.cpp b/llvm/lib/Support/NativeFormatting.cpp
index 95971321c1947..8a69f75132555 100644
--- a/llvm/lib/Support/NativeFormatting.cpp
+++ b/llvm/lib/Support/NativeFormatting.cpp
@@ -14,6 +14,10 @@
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"
 
+#if defined(_WIN32) && !defined(__MINGW32__)
+#include <float.h> // For _fpclass in llvm::write_double.
+#endif
+
 using namespace llvm;
 
 template<typename T, std::size_t N>

diff  --git a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
index 9d3fe2dbfbd59..2f8275978455f 100644
--- a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
+++ b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
@@ -31,6 +31,9 @@
 #include <immintrin.h>
 #include <intrin.h>
 #endif
+#if defined(__x86_64__) && defined(_MSC_VER)
+#include <float.h> // For _clearfp in ~X86SavedState().
+#endif
 
 namespace llvm {
 namespace exegesis {


        


More information about the llvm-commits mailing list