From c0ef1ffc9e2fdf070a016582228e2b854fb35594 Mon Sep 17 00:00:00 2001 From: Andrew Ng Date: Thu, 23 Jun 2022 15:16:48 +0100 Subject: [PATCH] [Build][NFC] Fixes for building on Windows with libc++ Differential Revision: https://reviews.llvm.org/D128514 --- llvm/include/llvm/Support/RWMutex.h | 4 ++-- llvm/lib/Support/NativeFormatting.cpp | 4 ++++ llvm/tools/llvm-exegesis/lib/X86/Target.cpp | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/Support/RWMutex.h b/llvm/include/llvm/Support/RWMutex.h index 33a5d3e..3dd9625 100644 --- a/llvm/include/llvm/Support/RWMutex.h +++ b/llvm/include/llvm/Support/RWMutex.h @@ -93,8 +93,8 @@ private: /// running in multithreaded mode. template 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 9597132..8a69f75 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 // For _fpclass in llvm::write_double. +#endif + using namespace llvm; template diff --git a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp index 9d3fe2d..2f82759 100644 --- a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp +++ b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp @@ -31,6 +31,9 @@ #include #include #endif +#if defined(__x86_64__) && defined(_MSC_VER) +#include // For _clearfp in ~X86SavedState(). +#endif namespace llvm { namespace exegesis { -- 2.7.4