From d0c5c776bceb389cae4fbd95d513dae4b023ecd7 Mon Sep 17 00:00:00 2001 From: Virgile Bello Date: Wed, 18 Sep 2013 08:09:31 +0000 Subject: [PATCH] Visual Studio 2013 compilation support: added some #ifdef _MSC_VER for unsupported code in MSVC. llvm-svn: 190924 --- lldb/source/Core/ConnectionFileDescriptor.cpp | 11 +++++++++++ lldb/source/Core/DataExtractor.cpp | 4 ++++ lldb/source/Core/Mangled.cpp | 6 ++++++ .../Utility/RegisterContextMacOSXFrameBackchain.cpp | 2 +- .../Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h | 4 ++-- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/lldb/source/Core/ConnectionFileDescriptor.cpp b/lldb/source/Core/ConnectionFileDescriptor.cpp index eb949de3c649..7d1540537d1e 100644 --- a/lldb/source/Core/ConnectionFileDescriptor.cpp +++ b/lldb/source/Core/ConnectionFileDescriptor.cpp @@ -42,6 +42,7 @@ // C++ Includes // Other libraries and framework includes +#include "llvm/Support/ErrorHandling.h" #if defined(__APPLE__) #include "llvm/ADT/SmallVector.h" #endif @@ -178,13 +179,21 @@ ConnectionFileDescriptor::CloseCommandPipe () if (m_pipe_read != -1) { +#ifdef _MSC_VER + llvm_unreachable("pipe close unsupported in MSVC"); +#else close (m_pipe_read); +#endif m_pipe_read = -1; } if (m_pipe_write != -1) { +#ifdef _MSC_VER + llvm_unreachable("pipe close unsupported in MSVC"); +#else close (m_pipe_write); +#endif m_pipe_write = -1; } } @@ -879,7 +888,9 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt // If this assert fires off on MacOSX, we will need to switch to using // libdispatch to read from file descriptors because poll() is causing // kernel panics and if we exceed FD_SETSIZE we will have no choice... +#ifndef _MSC_VER assert (data_fd < FD_SETSIZE); +#endif const bool have_pipe_fd = pipe_fd >= 0; diff --git a/lldb/source/Core/DataExtractor.cpp b/lldb/source/Core/DataExtractor.cpp index 055a28d6c3c5..dff6073fda02 100644 --- a/lldb/source/Core/DataExtractor.cpp +++ b/lldb/source/Core/DataExtractor.cpp @@ -1330,6 +1330,9 @@ DumpAPInt (Stream *s, const DataExtractor &data, lldb::offset_t offset, lldb::of static float half2float (uint16_t half) { +#ifdef _MSC_VER + llvm_unreachable("half2float not implemented for MSVC"); +#else union{ float f; uint32_t u;}u; int32_t v = (int16_t) half; @@ -1342,6 +1345,7 @@ static float half2float (uint16_t half) v <<= 13; u.u = v | 0x70000000U; return u.f * ldexpf(1, -112); +#endif } lldb::offset_t diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp index 4655eb131a6c..76d8520d59c8 100644 --- a/lldb/source/Core/Mangled.cpp +++ b/lldb/source/Core/Mangled.cpp @@ -10,7 +10,9 @@ // FreeBSD9-STABLE requires this to know about size_t in cxxabi.h #include +#ifndef _MSC_VER #include +#endif #include "llvm/ADT/DenseMap.h" @@ -199,7 +201,11 @@ Mangled::GetDemangledName () const { // We didn't already mangle this name, demangle it and if all goes well // add it to our map. +#if !defined(_MSC_VER) char *demangled_name = abi::__cxa_demangle (mangled_cstr, NULL, NULL, NULL); +#else + char *demangled_name = 0; +#endif if (demangled_name) { diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp index 2c3eee452488..2852ae0d542a 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp @@ -149,7 +149,7 @@ RegisterContextMacOSXFrameBackchain::ReadRegister (const RegisterInfo *reg_info, // TOOD: need a better way to detect when "long double" types are // the same bytes size as "double" -#if !defined(__arm__) +#if !defined(__arm__) && !defined(_MSC_VER) case sizeof (long double): if (sizeof (long double) == sizeof(uint32_t)) { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h index 941c83e58a44..5db541592050 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h @@ -13,7 +13,7 @@ #include "SymbolFileDWARF.h" #include #include -#if __cplusplus >= 201103L +#if __cplusplus >= 201103L || defined(_MSC_VER) #include #else #include @@ -87,7 +87,7 @@ protected: dw_offset_t m_offset; Header m_header; -#if __cplusplus >= 201103L +#if __cplusplus >= 201103L || defined(_MSC_VER) typedef std::unordered_multimap, CStringEqualBinaryPredicate> cstr_to_index_mmap; #else typedef __gnu_cxx::hash_multimap, CStringEqualBinaryPredicate> cstr_to_index_mmap;