s/LLVM_ON_WIN32/_WIN32/, llvm
LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in HandleLLVMOptions.cmake, which is where _WIN32 defined too. Just use the default macro instead of a reinvented one. See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev. No intended behavior change. This moves over all uses of the macro, but doesn't remove the definition of it in (llvm-)config.h yet. llvm-svn: 331127
This commit is contained in:
		
							parent
							
								
									d3d3d6b75d
								
							
						
					
					
						commit
						712e8d29c4
					
				| 
						 | 
					@ -209,10 +209,9 @@ Implementations of the System Library interface are separated by their general
 | 
				
			||||||
class of operating system. Currently only Unix and Win32 classes are defined
 | 
					class of operating system. Currently only Unix and Win32 classes are defined
 | 
				
			||||||
but more could be added for other operating system classifications.  To
 | 
					but more could be added for other operating system classifications.  To
 | 
				
			||||||
distinguish which implementation to compile, the code in ``lib/System`` uses
 | 
					distinguish which implementation to compile, the code in ``lib/System`` uses
 | 
				
			||||||
the ``LLVM_ON_UNIX`` and ``LLVM_ON_WIN32`` ``#defines`` provided via configure
 | 
					the ``LLVM_ON_UNIX`` and ``_WIN32`` ``#defines``.  Each source file in
 | 
				
			||||||
through the ``llvm/Config/config.h`` file. Each source file in ``lib/System``,
 | 
					``lib/System``, after implementing the generic (operating system independent)
 | 
				
			||||||
after implementing the generic (operating system independent) functionality
 | 
					functionality needs to include the correct implementation using a set of
 | 
				
			||||||
needs to include the correct implementation using a set of
 | 
					 | 
				
			||||||
``#if defined(LLVM_ON_XYZ)`` directives. For example, if we had
 | 
					``#if defined(LLVM_ON_XYZ)`` directives. For example, if we had
 | 
				
			||||||
``lib/System/File.cpp``, we'd expect to see in that file:
 | 
					``lib/System/File.cpp``, we'd expect to see in that file:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -221,7 +220,7 @@ needs to include the correct implementation using a set of
 | 
				
			||||||
  #if defined(LLVM_ON_UNIX)
 | 
					  #if defined(LLVM_ON_UNIX)
 | 
				
			||||||
  #include "Unix/File.cpp"
 | 
					  #include "Unix/File.cpp"
 | 
				
			||||||
  #endif
 | 
					  #endif
 | 
				
			||||||
  #if defined(LLVM_ON_WIN32)
 | 
					  #if defined(_WIN32)
 | 
				
			||||||
  #include "Win32/File.cpp"
 | 
					  #include "Win32/File.cpp"
 | 
				
			||||||
  #endif
 | 
					  #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -597,7 +597,7 @@ if we add:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. code-block:: c++
 | 
					.. code-block:: c++
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #ifdef LLVM_ON_WIN32
 | 
					    #ifdef _WIN32
 | 
				
			||||||
    #define DLLEXPORT __declspec(dllexport)
 | 
					    #define DLLEXPORT __declspec(dllexport)
 | 
				
			||||||
    #else
 | 
					    #else
 | 
				
			||||||
    #define DLLEXPORT
 | 
					    #define DLLEXPORT
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -651,7 +651,7 @@ static void MainLoop() {
 | 
				
			||||||
// "Library" functions that can be "extern'd" from user code.
 | 
					// "Library" functions that can be "extern'd" from user code.
 | 
				
			||||||
//===----------------------------------------------------------------------===//
 | 
					//===----------------------------------------------------------------------===//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#define DLLEXPORT __declspec(dllexport)
 | 
					#define DLLEXPORT __declspec(dllexport)
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define DLLEXPORT
 | 
					#define DLLEXPORT
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -925,7 +925,7 @@ static void MainLoop() {
 | 
				
			||||||
// "Library" functions that can be "extern'd" from user code.
 | 
					// "Library" functions that can be "extern'd" from user code.
 | 
				
			||||||
//===----------------------------------------------------------------------===//
 | 
					//===----------------------------------------------------------------------===//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#define DLLEXPORT __declspec(dllexport)
 | 
					#define DLLEXPORT __declspec(dllexport)
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define DLLEXPORT
 | 
					#define DLLEXPORT
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1044,7 +1044,7 @@ static void MainLoop() {
 | 
				
			||||||
// "Library" functions that can be "extern'd" from user code.
 | 
					// "Library" functions that can be "extern'd" from user code.
 | 
				
			||||||
//===----------------------------------------------------------------------===//
 | 
					//===----------------------------------------------------------------------===//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#define DLLEXPORT __declspec(dllexport)
 | 
					#define DLLEXPORT __declspec(dllexport)
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define DLLEXPORT
 | 
					#define DLLEXPORT
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1214,7 +1214,7 @@ static void MainLoop() {
 | 
				
			||||||
// "Library" functions that can be "extern'd" from user code.
 | 
					// "Library" functions that can be "extern'd" from user code.
 | 
				
			||||||
//===----------------------------------------------------------------------===//
 | 
					//===----------------------------------------------------------------------===//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#define DLLEXPORT __declspec(dllexport)
 | 
					#define DLLEXPORT __declspec(dllexport)
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define DLLEXPORT
 | 
					#define DLLEXPORT
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1173,7 +1173,7 @@ static void MainLoop() {
 | 
				
			||||||
// "Library" functions that can be "extern'd" from user code.
 | 
					// "Library" functions that can be "extern'd" from user code.
 | 
				
			||||||
//===----------------------------------------------------------------------===//
 | 
					//===----------------------------------------------------------------------===//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#define DLLEXPORT __declspec(dllexport)
 | 
					#define DLLEXPORT __declspec(dllexport)
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define DLLEXPORT
 | 
					#define DLLEXPORT
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1379,7 +1379,7 @@ static void MainLoop() {
 | 
				
			||||||
// "Library" functions that can be "extern'd" from user code.
 | 
					// "Library" functions that can be "extern'd" from user code.
 | 
				
			||||||
//===----------------------------------------------------------------------===//
 | 
					//===----------------------------------------------------------------------===//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#define DLLEXPORT __declspec(dllexport)
 | 
					#define DLLEXPORT __declspec(dllexport)
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define DLLEXPORT
 | 
					#define DLLEXPORT
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -88,7 +88,7 @@ private:
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  JITSymbol findMangledSymbol(const std::string &Name) {
 | 
					  JITSymbol findMangledSymbol(const std::string &Name) {
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
    // The symbol lookup of ObjectLinkingLayer uses the SymbolRef::SF_Exported
 | 
					    // The symbol lookup of ObjectLinkingLayer uses the SymbolRef::SF_Exported
 | 
				
			||||||
    // flag to decide whether a symbol will be visible or not, when we call
 | 
					    // flag to decide whether a symbol will be visible or not, when we call
 | 
				
			||||||
    // IRCompileLayer::findSymbolIn with ExportedSymbolsOnly set to true.
 | 
					    // IRCompileLayer::findSymbolIn with ExportedSymbolsOnly set to true.
 | 
				
			||||||
| 
						 | 
					@ -112,7 +112,7 @@ private:
 | 
				
			||||||
    if (auto SymAddr = RTDyldMemoryManager::getSymbolAddressInProcess(Name))
 | 
					    if (auto SymAddr = RTDyldMemoryManager::getSymbolAddressInProcess(Name))
 | 
				
			||||||
      return JITSymbol(SymAddr, JITSymbolFlags::Exported);
 | 
					      return JITSymbol(SymAddr, JITSymbolFlags::Exported);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
    // For Windows retry without "_" at beginning, as RTDyldMemoryManager uses
 | 
					    // For Windows retry without "_" at beginning, as RTDyldMemoryManager uses
 | 
				
			||||||
    // GetProcAddress and standard libraries like msvcrt.dll use names
 | 
					    // GetProcAddress and standard libraries like msvcrt.dll use names
 | 
				
			||||||
    // with and without "_" (for example "_itoa" but "sin").
 | 
					    // with and without "_" (for example "_itoa" but "sin").
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -153,7 +153,7 @@ protected:
 | 
				
			||||||
  uid_t fs_st_uid = 0;
 | 
					  uid_t fs_st_uid = 0;
 | 
				
			||||||
  gid_t fs_st_gid = 0;
 | 
					  gid_t fs_st_gid = 0;
 | 
				
			||||||
  off_t fs_st_size = 0;
 | 
					  off_t fs_st_size = 0;
 | 
				
			||||||
  #elif defined (LLVM_ON_WIN32)
 | 
					  #elif defined (_WIN32)
 | 
				
			||||||
  uint32_t LastAccessedTimeHigh = 0;
 | 
					  uint32_t LastAccessedTimeHigh = 0;
 | 
				
			||||||
  uint32_t LastAccessedTimeLow = 0;
 | 
					  uint32_t LastAccessedTimeLow = 0;
 | 
				
			||||||
  uint32_t LastWriteTimeHigh = 0;
 | 
					  uint32_t LastWriteTimeHigh = 0;
 | 
				
			||||||
| 
						 | 
					@ -174,7 +174,7 @@ public:
 | 
				
			||||||
                    uid_t UID, gid_t GID, off_t Size)
 | 
					                    uid_t UID, gid_t GID, off_t Size)
 | 
				
			||||||
      : fs_st_atime(ATime), fs_st_mtime(MTime), fs_st_uid(UID), fs_st_gid(GID),
 | 
					      : fs_st_atime(ATime), fs_st_mtime(MTime), fs_st_uid(UID), fs_st_gid(GID),
 | 
				
			||||||
        fs_st_size(Size), Type(Type), Perms(Perms) {}
 | 
					        fs_st_size(Size), Type(Type), Perms(Perms) {}
 | 
				
			||||||
#elif defined(LLVM_ON_WIN32)
 | 
					#elif defined(_WIN32)
 | 
				
			||||||
  basic_file_status(file_type Type, perms Perms, uint32_t LastAccessTimeHigh,
 | 
					  basic_file_status(file_type Type, perms Perms, uint32_t LastAccessTimeHigh,
 | 
				
			||||||
                    uint32_t LastAccessTimeLow, uint32_t LastWriteTimeHigh,
 | 
					                    uint32_t LastAccessTimeLow, uint32_t LastWriteTimeHigh,
 | 
				
			||||||
                    uint32_t LastWriteTimeLow, uint32_t FileSizeHigh,
 | 
					                    uint32_t LastWriteTimeLow, uint32_t FileSizeHigh,
 | 
				
			||||||
| 
						 | 
					@ -196,7 +196,7 @@ public:
 | 
				
			||||||
  uint32_t getUser() const { return fs_st_uid; }
 | 
					  uint32_t getUser() const { return fs_st_uid; }
 | 
				
			||||||
  uint32_t getGroup() const { return fs_st_gid; }
 | 
					  uint32_t getGroup() const { return fs_st_gid; }
 | 
				
			||||||
  uint64_t getSize() const { return fs_st_size; }
 | 
					  uint64_t getSize() const { return fs_st_size; }
 | 
				
			||||||
  #elif defined (LLVM_ON_WIN32)
 | 
					  #elif defined (_WIN32)
 | 
				
			||||||
  uint32_t getUser() const {
 | 
					  uint32_t getUser() const {
 | 
				
			||||||
    return 9999; // Not applicable to Windows, so...
 | 
					    return 9999; // Not applicable to Windows, so...
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -223,7 +223,7 @@ class file_status : public basic_file_status {
 | 
				
			||||||
  dev_t fs_st_dev = 0;
 | 
					  dev_t fs_st_dev = 0;
 | 
				
			||||||
  nlink_t fs_st_nlinks = 0;
 | 
					  nlink_t fs_st_nlinks = 0;
 | 
				
			||||||
  ino_t fs_st_ino = 0;
 | 
					  ino_t fs_st_ino = 0;
 | 
				
			||||||
  #elif defined (LLVM_ON_WIN32)
 | 
					  #elif defined (_WIN32)
 | 
				
			||||||
  uint32_t NumLinks = 0;
 | 
					  uint32_t NumLinks = 0;
 | 
				
			||||||
  uint32_t VolumeSerialNumber = 0;
 | 
					  uint32_t VolumeSerialNumber = 0;
 | 
				
			||||||
  uint32_t FileIndexHigh = 0;
 | 
					  uint32_t FileIndexHigh = 0;
 | 
				
			||||||
| 
						 | 
					@ -240,7 +240,7 @@ public:
 | 
				
			||||||
              time_t ATime, time_t MTime, uid_t UID, gid_t GID, off_t Size)
 | 
					              time_t ATime, time_t MTime, uid_t UID, gid_t GID, off_t Size)
 | 
				
			||||||
      : basic_file_status(Type, Perms, ATime, MTime, UID, GID, Size),
 | 
					      : basic_file_status(Type, Perms, ATime, MTime, UID, GID, Size),
 | 
				
			||||||
        fs_st_dev(Dev), fs_st_nlinks(Links), fs_st_ino(Ino) {}
 | 
					        fs_st_dev(Dev), fs_st_nlinks(Links), fs_st_ino(Ino) {}
 | 
				
			||||||
  #elif defined(LLVM_ON_WIN32)
 | 
					  #elif defined(_WIN32)
 | 
				
			||||||
  file_status(file_type Type, perms Perms, uint32_t LinkCount,
 | 
					  file_status(file_type Type, perms Perms, uint32_t LinkCount,
 | 
				
			||||||
              uint32_t LastAccessTimeHigh, uint32_t LastAccessTimeLow,
 | 
					              uint32_t LastAccessTimeHigh, uint32_t LastAccessTimeLow,
 | 
				
			||||||
              uint32_t LastWriteTimeHigh, uint32_t LastWriteTimeLow,
 | 
					              uint32_t LastWriteTimeHigh, uint32_t LastWriteTimeLow,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,7 +31,7 @@
 | 
				
			||||||
#define BYTE_ORDER LITTLE_ENDIAN
 | 
					#define BYTE_ORDER LITTLE_ENDIAN
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#if !defined(BYTE_ORDER) && !defined(LLVM_ON_WIN32)
 | 
					#if !defined(BYTE_ORDER) && !defined(_WIN32)
 | 
				
			||||||
#include <machine/endian.h>
 | 
					#include <machine/endian.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,7 +27,7 @@ namespace sys {
 | 
				
			||||||
  // a colon on Unix or a semicolon on Windows.
 | 
					  // a colon on Unix or a semicolon on Windows.
 | 
				
			||||||
#if defined(LLVM_ON_UNIX)
 | 
					#if defined(LLVM_ON_UNIX)
 | 
				
			||||||
  const char EnvPathSeparator = ':';
 | 
					  const char EnvPathSeparator = ':';
 | 
				
			||||||
#elif defined (LLVM_ON_WIN32)
 | 
					#elif defined (_WIN32)
 | 
				
			||||||
  const char EnvPathSeparator = ';';
 | 
					  const char EnvPathSeparator = ';';
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,7 +35,7 @@ namespace sys {
 | 
				
			||||||
struct ProcessInfo {
 | 
					struct ProcessInfo {
 | 
				
			||||||
#if defined(LLVM_ON_UNIX)
 | 
					#if defined(LLVM_ON_UNIX)
 | 
				
			||||||
  typedef pid_t ProcessId;
 | 
					  typedef pid_t ProcessId;
 | 
				
			||||||
#elif defined(LLVM_ON_WIN32)
 | 
					#elif defined(_WIN32)
 | 
				
			||||||
  typedef unsigned long ProcessId; // Must match the type of DWORD on Windows.
 | 
					  typedef unsigned long ProcessId; // Must match the type of DWORD on Windows.
 | 
				
			||||||
  typedef void * HANDLE; // Must match the type of HANDLE on Windows.
 | 
					  typedef void * HANDLE; // Must match the type of HANDLE on Windows.
 | 
				
			||||||
  /// The handle to the process (available on Windows only).
 | 
					  /// The handle to the process (available on Windows only).
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -207,7 +207,7 @@ static std::string computeRelativePath(StringRef From, StringRef To) {
 | 
				
			||||||
  for (auto ToE = sys::path::end(To); ToI != ToE; ++ToI)
 | 
					  for (auto ToE = sys::path::end(To); ToI != ToE; ++ToI)
 | 
				
			||||||
    sys::path::append(Relative, *ToI);
 | 
					    sys::path::append(Relative, *ToI);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
  // Replace backslashes with slashes so that the path is portable between *nix
 | 
					  // Replace backslashes with slashes so that the path is portable between *nix
 | 
				
			||||||
  // and Windows.
 | 
					  // and Windows.
 | 
				
			||||||
  std::replace(Relative.begin(), Relative.end(), '\\', '/');
 | 
					  std::replace(Relative.begin(), Relative.end(), '\\', '/');
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,6 +18,6 @@
 | 
				
			||||||
// Include the platform-specific parts of this class.
 | 
					// Include the platform-specific parts of this class.
 | 
				
			||||||
#ifdef LLVM_ON_UNIX
 | 
					#ifdef LLVM_ON_UNIX
 | 
				
			||||||
#include "Unix/COM.inc"
 | 
					#include "Unix/COM.inc"
 | 
				
			||||||
#elif LLVM_ON_WIN32
 | 
					#elif _WIN32
 | 
				
			||||||
#include "Windows/COM.inc"
 | 
					#include "Windows/COM.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@ static inline struct tm getStructTM(TimePoint<> TP) {
 | 
				
			||||||
  assert(LT);
 | 
					  assert(LT);
 | 
				
			||||||
  (void)LT;
 | 
					  (void)LT;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#if defined(LLVM_ON_WIN32)
 | 
					#if defined(_WIN32)
 | 
				
			||||||
  int Error = ::localtime_s(&Storage, &OurTime);
 | 
					  int Error = ::localtime_s(&Storage, &OurTime);
 | 
				
			||||||
  assert(!Error);
 | 
					  assert(!Error);
 | 
				
			||||||
  (void)Error;
 | 
					  (void)Error;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if LLVM_ON_UNIX
 | 
					#if LLVM_ON_UNIX
 | 
				
			||||||
#include <unistd.h>
 | 
					#include <unistd.h>
 | 
				
			||||||
#elif LLVM_ON_WIN32
 | 
					#elif _WIN32
 | 
				
			||||||
#include <windows.h>
 | 
					#include <windows.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -93,7 +93,7 @@ bool CodeGenCoverage::emit(StringRef CoveragePrefix,
 | 
				
			||||||
    std::string Pid =
 | 
					    std::string Pid =
 | 
				
			||||||
#if LLVM_ON_UNIX
 | 
					#if LLVM_ON_UNIX
 | 
				
			||||||
        llvm::to_string(::getpid());
 | 
					        llvm::to_string(::getpid());
 | 
				
			||||||
#elif LLVM_ON_WIN32
 | 
					#elif _WIN32
 | 
				
			||||||
        llvm::to_string(::GetCurrentProcessId());
 | 
					        llvm::to_string(::GetCurrentProcessId());
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
        "";
 | 
					        "";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -189,7 +189,7 @@ bool CrashRecoveryContext::RunSafely(function_ref<void()> Fn) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#else // !_MSC_VER
 | 
					#else // !_MSC_VER
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(LLVM_ON_WIN32)
 | 
					#if defined(_WIN32)
 | 
				
			||||||
// This is a non-MSVC compiler, probably mingw gcc or clang without
 | 
					// This is a non-MSVC compiler, probably mingw gcc or clang without
 | 
				
			||||||
// -fms-extensions. Use vectored exception handling (VEH).
 | 
					// -fms-extensions. Use vectored exception handling (VEH).
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
| 
						 | 
					@ -272,7 +272,7 @@ static void uninstallExceptionOrSignalHandlers() {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#else // !LLVM_ON_WIN32
 | 
					#else // !_WIN32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Generic POSIX implementation.
 | 
					// Generic POSIX implementation.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
| 
						 | 
					@ -342,7 +342,7 @@ static void uninstallExceptionOrSignalHandlers() {
 | 
				
			||||||
    sigaction(Signals[i], &PrevActions[i], nullptr);
 | 
					    sigaction(Signals[i], &PrevActions[i], nullptr);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // !LLVM_ON_WIN32
 | 
					#endif // !_WIN32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool CrashRecoveryContext::RunSafely(function_ref<void()> Fn) {
 | 
					bool CrashRecoveryContext::RunSafely(function_ref<void()> Fn) {
 | 
				
			||||||
  // If crash recovery is disabled, do nothing.
 | 
					  // If crash recovery is disabled, do nothing.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,7 +49,7 @@ public:
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool AddLibrary(void *Handle, bool IsProcess = false, bool CanClose = true) {
 | 
					  bool AddLibrary(void *Handle, bool IsProcess = false, bool CanClose = true) {
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
    assert((Handle == this ? IsProcess : !IsProcess) && "Bad Handle.");
 | 
					    assert((Handle == this ? IsProcess : !IsProcess) && "Bad Handle.");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -61,7 +61,7 @@ public:
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      Handles.push_back(Handle);
 | 
					      Handles.push_back(Handle);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
#ifndef LLVM_ON_WIN32
 | 
					#ifndef _WIN32
 | 
				
			||||||
      if (Process) {
 | 
					      if (Process) {
 | 
				
			||||||
        if (CanClose)
 | 
					        if (CanClose)
 | 
				
			||||||
          DLClose(Process);
 | 
					          DLClose(Process);
 | 
				
			||||||
| 
						 | 
					@ -121,7 +121,7 @@ static llvm::ManagedStatic<DynamicLibrary::HandleSet> OpenedHandles;
 | 
				
			||||||
static llvm::ManagedStatic<llvm::sys::SmartMutex<true>> SymbolsMutex;
 | 
					static llvm::ManagedStatic<llvm::sys::SmartMutex<true>> SymbolsMutex;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "Windows/DynamicLibrary.inc"
 | 
					#include "Windows/DynamicLibrary.inc"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -243,7 +243,7 @@ void LLVMResetFatalErrorHandler() {
 | 
				
			||||||
  remove_fatal_error_handler();
 | 
					  remove_fatal_error_handler();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <winerror.h>
 | 
					#include <winerror.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -115,7 +115,7 @@ createOnDiskBuffer(StringRef Path, size_t Size, unsigned Mode) {
 | 
				
			||||||
    return FileOrErr.takeError();
 | 
					    return FileOrErr.takeError();
 | 
				
			||||||
  fs::TempFile File = std::move(*FileOrErr);
 | 
					  fs::TempFile File = std::move(*FileOrErr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef LLVM_ON_WIN32
 | 
					#ifndef _WIN32
 | 
				
			||||||
  // On Windows, CreateFileMapping (the mmap function on Windows)
 | 
					  // On Windows, CreateFileMapping (the mmap function on Windows)
 | 
				
			||||||
  // automatically extends the underlying file. We don't need to
 | 
					  // automatically extends the underlying file. We don't need to
 | 
				
			||||||
  // extend the file beforehand. _chsize (ftruncate on Windows) is
 | 
					  // extend the file beforehand. _chsize (ftruncate on Windows) is
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -221,7 +221,7 @@ bool llvm::DisplayGraph(StringRef FilenameRef, bool wait,
 | 
				
			||||||
    Viewer = VK_Ghostview;
 | 
					    Viewer = VK_Ghostview;
 | 
				
			||||||
  if (!Viewer && S.TryFindProgram("xdg-open", ViewerPath))
 | 
					  if (!Viewer && S.TryFindProgram("xdg-open", ViewerPath))
 | 
				
			||||||
    Viewer = VK_XDGOpen;
 | 
					    Viewer = VK_XDGOpen;
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
  if (!Viewer && S.TryFindProgram("cmd", ViewerPath)) {
 | 
					  if (!Viewer && S.TryFindProgram("cmd", ViewerPath)) {
 | 
				
			||||||
    Viewer = VK_CmdStart;
 | 
					    Viewer = VK_CmdStart;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -296,7 +296,7 @@ bool llvm::DisplayGraph(StringRef FilenameRef, bool wait,
 | 
				
			||||||
    args.push_back(nullptr);
 | 
					    args.push_back(nullptr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Dotty spawns another app and doesn't wait until it returns
 | 
					// Dotty spawns another app and doesn't wait until it returns
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
    wait = false;
 | 
					    wait = false;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    errs() << "Running 'dotty' program... ";
 | 
					    errs() << "Running 'dotty' program... ";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,7 +30,7 @@
 | 
				
			||||||
#ifdef LLVM_ON_UNIX
 | 
					#ifdef LLVM_ON_UNIX
 | 
				
			||||||
#include "Unix/Host.inc"
 | 
					#include "Unix/Host.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#include "Windows/Host.inc"
 | 
					#include "Windows/Host.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef _MSC_VER
 | 
					#ifdef _MSC_VER
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@ namespace sys {
 | 
				
			||||||
namespace locale {
 | 
					namespace locale {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int columnWidth(StringRef Text) {
 | 
					int columnWidth(StringRef Text) {
 | 
				
			||||||
#if LLVM_ON_WIN32
 | 
					#if _WIN32
 | 
				
			||||||
  return Text.size();
 | 
					  return Text.size();
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
  return llvm::sys::unicode::columnWidthUTF8(Text);
 | 
					  return llvm::sys::unicode::columnWidthUTF8(Text);
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,7 @@ int columnWidth(StringRef Text) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool isPrint(int UCS) {
 | 
					bool isPrint(int UCS) {
 | 
				
			||||||
#if LLVM_ON_WIN32
 | 
					#if _WIN32
 | 
				
			||||||
  // Restrict characters that we'll try to print to the lower part of ASCII
 | 
					  // Restrict characters that we'll try to print to the lower part of ASCII
 | 
				
			||||||
  // except for the control characters (0x20 - 0x7E). In general one can not
 | 
					  // except for the control characters (0x20 - 0x7E). In general one can not
 | 
				
			||||||
  // reliably output code points U+0080 and higher using narrow character C/C++
 | 
					  // reliably output code points U+0080 and higher using narrow character C/C++
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,7 +25,7 @@
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
#include <system_error>
 | 
					#include <system_error>
 | 
				
			||||||
#include <tuple>
 | 
					#include <tuple>
 | 
				
			||||||
#if LLVM_ON_WIN32
 | 
					#if _WIN32
 | 
				
			||||||
#include <windows.h>
 | 
					#include <windows.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#if LLVM_ON_UNIX
 | 
					#if LLVM_ON_UNIX
 | 
				
			||||||
| 
						 | 
					@ -258,7 +258,7 @@ LockFileManager::WaitForUnlockResult LockFileManager::waitForUnlock() {
 | 
				
			||||||
  if (getState() != LFS_Shared)
 | 
					  if (getState() != LFS_Shared)
 | 
				
			||||||
    return Res_Success;
 | 
					    return Res_Success;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if LLVM_ON_WIN32
 | 
					#if _WIN32
 | 
				
			||||||
  unsigned long Interval = 1;
 | 
					  unsigned long Interval = 1;
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
  struct timespec Interval;
 | 
					  struct timespec Interval;
 | 
				
			||||||
| 
						 | 
					@ -273,7 +273,7 @@ LockFileManager::WaitForUnlockResult LockFileManager::waitForUnlock() {
 | 
				
			||||||
    // finish up and remove the lock file.
 | 
					    // finish up and remove the lock file.
 | 
				
			||||||
    // FIXME: Should we hook in to system APIs to get a notification when the
 | 
					    // FIXME: Should we hook in to system APIs to get a notification when the
 | 
				
			||||||
    // lock file is deleted?
 | 
					    // lock file is deleted?
 | 
				
			||||||
#if LLVM_ON_WIN32
 | 
					#if _WIN32
 | 
				
			||||||
    Sleep(Interval);
 | 
					    Sleep(Interval);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
    nanosleep(&Interval, nullptr);
 | 
					    nanosleep(&Interval, nullptr);
 | 
				
			||||||
| 
						 | 
					@ -292,7 +292,7 @@ LockFileManager::WaitForUnlockResult LockFileManager::waitForUnlock() {
 | 
				
			||||||
      return Res_OwnerDied;
 | 
					      return Res_OwnerDied;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Exponentially increase the time we wait for the lock to be removed.
 | 
					    // Exponentially increase the time we wait for the lock to be removed.
 | 
				
			||||||
#if LLVM_ON_WIN32
 | 
					#if _WIN32
 | 
				
			||||||
    Interval *= 2;
 | 
					    Interval *= 2;
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
    Interval.tv_sec *= 2;
 | 
					    Interval.tv_sec *= 2;
 | 
				
			||||||
| 
						 | 
					@ -303,7 +303,7 @@ LockFileManager::WaitForUnlockResult LockFileManager::waitForUnlock() {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
  } while (
 | 
					  } while (
 | 
				
			||||||
#if LLVM_ON_WIN32
 | 
					#if _WIN32
 | 
				
			||||||
           Interval < MaxSeconds * 1000
 | 
					           Interval < MaxSeconds * 1000
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
           Interval.tv_sec < (time_t)MaxSeconds
 | 
					           Interval.tv_sec < (time_t)MaxSeconds
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,6 @@
 | 
				
			||||||
#ifdef LLVM_ON_UNIX
 | 
					#ifdef LLVM_ON_UNIX
 | 
				
			||||||
#include "Unix/Memory.inc"
 | 
					#include "Unix/Memory.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#include "Windows/Memory.inc"
 | 
					#include "Windows/Memory.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -119,9 +119,9 @@ MutexImpl::tryacquire()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#elif defined(LLVM_ON_UNIX)
 | 
					#elif defined(LLVM_ON_UNIX)
 | 
				
			||||||
#include "Unix/Mutex.inc"
 | 
					#include "Unix/Mutex.inc"
 | 
				
			||||||
#elif defined( LLVM_ON_WIN32)
 | 
					#elif defined( _WIN32)
 | 
				
			||||||
#include "Windows/Mutex.inc"
 | 
					#include "Windows/Mutex.inc"
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#warning Neither LLVM_ON_UNIX nor LLVM_ON_WIN32 was set in Support/Mutex.cpp
 | 
					#warning Neither LLVM_ON_UNIX nor _WIN32 was set in Support/Mutex.cpp
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,7 +37,7 @@ namespace {
 | 
				
			||||||
  using llvm::sys::path::Style;
 | 
					  using llvm::sys::path::Style;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  inline Style real_style(Style style) {
 | 
					  inline Style real_style(Style style) {
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
    return (style == Style::posix) ? Style::posix : Style::windows;
 | 
					    return (style == Style::posix) ? Style::posix : Style::windows;
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
    return (style == Style::windows) ? Style::windows : Style::posix;
 | 
					    return (style == Style::windows) ? Style::windows : Style::posix;
 | 
				
			||||||
| 
						 | 
					@ -1073,7 +1073,7 @@ ErrorOr<perms> getPermissions(const Twine &Path) {
 | 
				
			||||||
#if defined(LLVM_ON_UNIX)
 | 
					#if defined(LLVM_ON_UNIX)
 | 
				
			||||||
#include "Unix/Path.inc"
 | 
					#include "Unix/Path.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#if defined(LLVM_ON_WIN32)
 | 
					#if defined(_WIN32)
 | 
				
			||||||
#include "Windows/Path.inc"
 | 
					#include "Windows/Path.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1095,7 +1095,7 @@ Error TempFile::discard() {
 | 
				
			||||||
  Done = true;
 | 
					  Done = true;
 | 
				
			||||||
  std::error_code RemoveEC;
 | 
					  std::error_code RemoveEC;
 | 
				
			||||||
// On windows closing will remove the file.
 | 
					// On windows closing will remove the file.
 | 
				
			||||||
#ifndef LLVM_ON_WIN32
 | 
					#ifndef _WIN32
 | 
				
			||||||
  // Always try to close and remove.
 | 
					  // Always try to close and remove.
 | 
				
			||||||
  if (!TmpName.empty()) {
 | 
					  if (!TmpName.empty()) {
 | 
				
			||||||
    RemoveEC = fs::remove(TmpName);
 | 
					    RemoveEC = fs::remove(TmpName);
 | 
				
			||||||
| 
						 | 
					@ -1119,7 +1119,7 @@ Error TempFile::keep(const Twine &Name) {
 | 
				
			||||||
  assert(!Done);
 | 
					  assert(!Done);
 | 
				
			||||||
  Done = true;
 | 
					  Done = true;
 | 
				
			||||||
  // Always try to close and rename.
 | 
					  // Always try to close and rename.
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
  // If we cant't cancel the delete don't rename.
 | 
					  // If we cant't cancel the delete don't rename.
 | 
				
			||||||
  std::error_code RenameEC = cancelDeleteOnClose(FD);
 | 
					  std::error_code RenameEC = cancelDeleteOnClose(FD);
 | 
				
			||||||
  if (!RenameEC)
 | 
					  if (!RenameEC)
 | 
				
			||||||
| 
						 | 
					@ -1151,7 +1151,7 @@ Error TempFile::keep() {
 | 
				
			||||||
  assert(!Done);
 | 
					  assert(!Done);
 | 
				
			||||||
  Done = true;
 | 
					  Done = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
  if (std::error_code EC = cancelDeleteOnClose(FD))
 | 
					  if (std::error_code EC = cancelDeleteOnClose(FD))
 | 
				
			||||||
    return errorCodeToError(EC);
 | 
					    return errorCodeToError(EC);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
| 
						 | 
					@ -1177,7 +1177,7 @@ Expected<TempFile> TempFile::create(const Twine &Model, unsigned Mode) {
 | 
				
			||||||
    return errorCodeToError(EC);
 | 
					    return errorCodeToError(EC);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TempFile Ret(ResultPath, FD);
 | 
					  TempFile Ret(ResultPath, FD);
 | 
				
			||||||
#ifndef LLVM_ON_WIN32
 | 
					#ifndef _WIN32
 | 
				
			||||||
  if (sys::RemoveFileOnSignal(ResultPath)) {
 | 
					  if (sys::RemoveFileOnSignal(ResultPath)) {
 | 
				
			||||||
    // Make sure we delete the file when RemoveFileOnSignal fails.
 | 
					    // Make sure we delete the file when RemoveFileOnSignal fails.
 | 
				
			||||||
    consumeError(Ret.discard());
 | 
					    consumeError(Ret.discard());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -93,6 +93,6 @@ bool Process::AreCoreFilesPrevented() {
 | 
				
			||||||
#ifdef LLVM_ON_UNIX
 | 
					#ifdef LLVM_ON_UNIX
 | 
				
			||||||
#include "Unix/Process.inc"
 | 
					#include "Unix/Process.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#include "Windows/Process.inc"
 | 
					#include "Windows/Process.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,6 +67,6 @@ ProcessInfo sys::ExecuteNoWait(StringRef Program, const char **Args,
 | 
				
			||||||
#ifdef LLVM_ON_UNIX
 | 
					#ifdef LLVM_ON_UNIX
 | 
				
			||||||
#include "Unix/Program.inc"
 | 
					#include "Unix/Program.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#include "Windows/Program.inc"
 | 
					#include "Windows/Program.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -117,9 +117,9 @@ RWMutexImpl::writer_release()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#elif defined(LLVM_ON_UNIX)
 | 
					#elif defined(LLVM_ON_UNIX)
 | 
				
			||||||
#include "Unix/RWMutex.inc"
 | 
					#include "Unix/RWMutex.inc"
 | 
				
			||||||
#elif defined( LLVM_ON_WIN32)
 | 
					#elif defined( _WIN32)
 | 
				
			||||||
#include "Windows/RWMutex.inc"
 | 
					#include "Windows/RWMutex.inc"
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#warning Neither LLVM_ON_UNIX nor LLVM_ON_WIN32 was set in Support/Mutex.cpp
 | 
					#warning Neither LLVM_ON_UNIX nor _WIN32 was set in Support/Mutex.cpp
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,7 +17,7 @@
 | 
				
			||||||
#include "llvm/Support/CommandLine.h"
 | 
					#include "llvm/Support/CommandLine.h"
 | 
				
			||||||
#include "llvm/Support/Debug.h"
 | 
					#include "llvm/Support/Debug.h"
 | 
				
			||||||
#include "llvm/Support/raw_ostream.h"
 | 
					#include "llvm/Support/raw_ostream.h"
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#include "Windows/WindowsSupport.h"
 | 
					#include "Windows/WindowsSupport.h"
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#include "Unix/Unix.h"
 | 
					#include "Unix/Unix.h"
 | 
				
			||||||
| 
						 | 
					@ -63,7 +63,7 @@ RandomNumberGenerator::result_type RandomNumberGenerator::operator()() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Get random vector of specified size
 | 
					// Get random vector of specified size
 | 
				
			||||||
std::error_code llvm::getRandomBytes(void *Buffer, size_t Size) {
 | 
					std::error_code llvm::getRandomBytes(void *Buffer, size_t Size) {
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
  HCRYPTPROV hProvider;
 | 
					  HCRYPTPROV hProvider;
 | 
				
			||||||
  if (CryptAcquireContext(&hProvider, 0, 0, PROV_RSA_FULL,
 | 
					  if (CryptAcquireContext(&hProvider, 0, 0, PROV_RSA_FULL,
 | 
				
			||||||
                           CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
 | 
					                           CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -125,7 +125,7 @@ static bool printSymbolizedStackTrace(StringRef Argv0,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Optional<StringRef> Redirects[] = {InputFile.str(), OutputFile.str(), llvm::None};
 | 
					  Optional<StringRef> Redirects[] = {InputFile.str(), OutputFile.str(), llvm::None};
 | 
				
			||||||
  const char *Args[] = {"llvm-symbolizer", "--functions=linkage", "--inlining",
 | 
					  const char *Args[] = {"llvm-symbolizer", "--functions=linkage", "--inlining",
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
                        // Pass --relative-address on Windows so that we don't
 | 
					                        // Pass --relative-address on Windows so that we don't
 | 
				
			||||||
                        // have to add ImageBase from PE file.
 | 
					                        // have to add ImageBase from PE file.
 | 
				
			||||||
                        // FIXME: Make this the default for llvm-symbolizer.
 | 
					                        // FIXME: Make this the default for llvm-symbolizer.
 | 
				
			||||||
| 
						 | 
					@ -180,6 +180,6 @@ static bool printSymbolizedStackTrace(StringRef Argv0,
 | 
				
			||||||
#ifdef LLVM_ON_UNIX
 | 
					#ifdef LLVM_ON_UNIX
 | 
				
			||||||
#include "Unix/Signals.inc"
 | 
					#include "Unix/Signals.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#include "Windows/Signals.inc"
 | 
					#include "Windows/Signals.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,8 +41,8 @@ void ThreadLocalImpl::removeInstance() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#elif defined(LLVM_ON_UNIX)
 | 
					#elif defined(LLVM_ON_UNIX)
 | 
				
			||||||
#include "Unix/ThreadLocal.inc"
 | 
					#include "Unix/ThreadLocal.inc"
 | 
				
			||||||
#elif defined( LLVM_ON_WIN32)
 | 
					#elif defined( _WIN32)
 | 
				
			||||||
#include "Windows/ThreadLocal.inc"
 | 
					#include "Windows/ThreadLocal.inc"
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#warning Neither LLVM_ON_UNIX nor LLVM_ON_WIN32 set in Support/ThreadLocal.cpp
 | 
					#warning Neither LLVM_ON_UNIX nor _WIN32 set in Support/ThreadLocal.cpp
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,7 +37,7 @@ bool llvm::llvm_is_multithreaded() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if LLVM_ENABLE_THREADS == 0 ||                                                \
 | 
					#if LLVM_ENABLE_THREADS == 0 ||                                                \
 | 
				
			||||||
    (!defined(LLVM_ON_WIN32) && !defined(HAVE_PTHREAD_H))
 | 
					    (!defined(_WIN32) && !defined(HAVE_PTHREAD_H))
 | 
				
			||||||
// Support for non-Win32, non-pthread implementation.
 | 
					// Support for non-Win32, non-pthread implementation.
 | 
				
			||||||
void llvm::llvm_execute_on_thread(void (*Fn)(void *), void *UserData,
 | 
					void llvm::llvm_execute_on_thread(void (*Fn)(void *), void *UserData,
 | 
				
			||||||
                                  unsigned RequestedStackSize) {
 | 
					                                  unsigned RequestedStackSize) {
 | 
				
			||||||
| 
						 | 
					@ -89,7 +89,7 @@ unsigned llvm::hardware_concurrency() {
 | 
				
			||||||
#ifdef LLVM_ON_UNIX
 | 
					#ifdef LLVM_ON_UNIX
 | 
				
			||||||
#include "Unix/Threading.inc"
 | 
					#include "Unix/Threading.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#include "Windows/Threading.inc"
 | 
					#include "Windows/Threading.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -98,7 +98,7 @@ uint64_t llvm::get_threadid() {
 | 
				
			||||||
  return uint64_t(gettid());
 | 
					  return uint64_t(gettid());
 | 
				
			||||||
#elif defined(__linux__)
 | 
					#elif defined(__linux__)
 | 
				
			||||||
  return uint64_t(syscall(SYS_gettid));
 | 
					  return uint64_t(syscall(SYS_gettid));
 | 
				
			||||||
#elif defined(LLVM_ON_WIN32)
 | 
					#elif defined(_WIN32)
 | 
				
			||||||
  return uint64_t(::GetCurrentThreadId());
 | 
					  return uint64_t(::GetCurrentThreadId());
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
  return uint64_t(pthread_self());
 | 
					  return uint64_t(pthread_self());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,6 +18,6 @@
 | 
				
			||||||
#ifdef LLVM_ON_UNIX
 | 
					#ifdef LLVM_ON_UNIX
 | 
				
			||||||
#include "Unix/Watchdog.inc"
 | 
					#include "Unix/Watchdog.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#include "Windows/Watchdog.inc"
 | 
					#include "Windows/Watchdog.inc"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,7 +59,7 @@
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#include "Windows/WindowsSupport.h"
 | 
					#include "Windows/WindowsSupport.h"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -533,7 +533,7 @@ raw_fd_ostream::raw_fd_ostream(int fd, bool shouldClose, bool unbuffered)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Get the starting position.
 | 
					  // Get the starting position.
 | 
				
			||||||
  off_t loc = ::lseek(FD, 0, SEEK_CUR);
 | 
					  off_t loc = ::lseek(FD, 0, SEEK_CUR);
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
  // MSVCRT's _lseek(SEEK_CUR) doesn't return -1 for pipes.
 | 
					  // MSVCRT's _lseek(SEEK_CUR) doesn't return -1 for pipes.
 | 
				
			||||||
  sys::fs::file_status Status;
 | 
					  sys::fs::file_status Status;
 | 
				
			||||||
  std::error_code EC = status(FD, Status);
 | 
					  std::error_code EC = status(FD, Status);
 | 
				
			||||||
| 
						 | 
					@ -586,7 +586,7 @@ void raw_fd_ostream::write_impl(const char *Ptr, size_t Size) {
 | 
				
			||||||
  // It is observed that Linux returns EINVAL for a very large write (>2G).
 | 
					  // It is observed that Linux returns EINVAL for a very large write (>2G).
 | 
				
			||||||
  // Make it a reasonably small value.
 | 
					  // Make it a reasonably small value.
 | 
				
			||||||
  MaxWriteSize = 1024 * 1024 * 1024;
 | 
					  MaxWriteSize = 1024 * 1024 * 1024;
 | 
				
			||||||
#elif defined(LLVM_ON_WIN32)
 | 
					#elif defined(_WIN32)
 | 
				
			||||||
  // Writing a large size of output to Windows console returns ENOMEM. It seems
 | 
					  // Writing a large size of output to Windows console returns ENOMEM. It seems
 | 
				
			||||||
  // that, prior to Windows 8, WriteFile() is redirecting to WriteConsole(), and
 | 
					  // that, prior to Windows 8, WriteFile() is redirecting to WriteConsole(), and
 | 
				
			||||||
  // the latter has a size limit (66000 bytes or less, depending on heap usage).
 | 
					  // the latter has a size limit (66000 bytes or less, depending on heap usage).
 | 
				
			||||||
| 
						 | 
					@ -639,7 +639,7 @@ void raw_fd_ostream::close() {
 | 
				
			||||||
uint64_t raw_fd_ostream::seek(uint64_t off) {
 | 
					uint64_t raw_fd_ostream::seek(uint64_t off) {
 | 
				
			||||||
  assert(SupportsSeeking && "Stream does not support seeking!");
 | 
					  assert(SupportsSeeking && "Stream does not support seeking!");
 | 
				
			||||||
  flush();
 | 
					  flush();
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
  pos = ::_lseeki64(FD, off, SEEK_SET);
 | 
					  pos = ::_lseeki64(FD, off, SEEK_SET);
 | 
				
			||||||
#elif defined(HAVE_LSEEK64)
 | 
					#elif defined(HAVE_LSEEK64)
 | 
				
			||||||
  pos = ::lseek64(FD, off, SEEK_SET);
 | 
					  pos = ::lseek64(FD, off, SEEK_SET);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -206,7 +206,7 @@ void AbstractInterpreter::anchor() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(LLVM_ON_UNIX)
 | 
					#if defined(LLVM_ON_UNIX)
 | 
				
			||||||
const char EXESuffix[] = "";
 | 
					const char EXESuffix[] = "";
 | 
				
			||||||
#elif defined(LLVM_ON_WIN32)
 | 
					#elif defined(_WIN32)
 | 
				
			||||||
const char EXESuffix[] = "exe";
 | 
					const char EXESuffix[] = "exe";
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -96,7 +96,7 @@ struct LTOToolDiagnosticHandler : public DiagnosticHandler {
 | 
				
			||||||
// Initialize the configured targets if they have not been initialized.
 | 
					// Initialize the configured targets if they have not been initialized.
 | 
				
			||||||
static void lto_initialize() {
 | 
					static void lto_initialize() {
 | 
				
			||||||
  if (!initialized) {
 | 
					  if (!initialized) {
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
    // Dialog box on crash disabling doesn't work across DLL boundaries, so do
 | 
					    // Dialog box on crash disabling doesn't work across DLL boundaries, so do
 | 
				
			||||||
    // it here.
 | 
					    // it here.
 | 
				
			||||||
    llvm::sys::DisableSystemDialogsOnCrash();
 | 
					    llvm::sys::DisableSystemDialogsOnCrash();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,10 +46,10 @@ protected:
 | 
				
			||||||
    // fail to initialize the AssumptionCacheTracker.
 | 
					    // fail to initialize the AssumptionCacheTracker.
 | 
				
			||||||
    initializeAssumptionCacheTrackerPass(*PassRegistry::getPassRegistry());
 | 
					    initializeAssumptionCacheTrackerPass(*PassRegistry::getPassRegistry());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
    // On Windows, generate ELF objects by specifying "-elf" in triple
 | 
					    // On Windows, generate ELF objects by specifying "-elf" in triple
 | 
				
			||||||
    HostTriple += "-elf";
 | 
					    HostTriple += "-elf";
 | 
				
			||||||
#endif // LLVM_ON_WIN32
 | 
					#endif // _WIN32
 | 
				
			||||||
    HostTriple = Triple::normalize(HostTriple);
 | 
					    HostTriple = Triple::normalize(HostTriple);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -195,7 +195,7 @@ struct LockMutex : ValueMapConfig<KeyT, MutexT> {
 | 
				
			||||||
  static MutexT *getMutex(const ExtraData &Data) { return Data.M; }
 | 
					  static MutexT *getMutex(const ExtraData &Data) { return Data.M; }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
// FIXME: These tests started failing on Windows.
 | 
					// FIXME: These tests started failing on Windows.
 | 
				
			||||||
#if LLVM_ENABLE_THREADS && !defined(LLVM_ON_WIN32)
 | 
					#if LLVM_ENABLE_THREADS && !defined(_WIN32)
 | 
				
			||||||
TYPED_TEST(ValueMapTest, LocksMutex) {
 | 
					TYPED_TEST(ValueMapTest, LocksMutex) {
 | 
				
			||||||
  sys::Mutex M(false);  // Not recursive.
 | 
					  sys::Mutex M(false);  // Not recursive.
 | 
				
			||||||
  bool CalledRAUW = false, CalledDeleted = false;
 | 
					  bool CalledRAUW = false, CalledDeleted = false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,7 +11,7 @@
 | 
				
			||||||
#include "llvm/Support/CrashRecoveryContext.h"
 | 
					#include "llvm/Support/CrashRecoveryContext.h"
 | 
				
			||||||
#include "gtest/gtest.h"
 | 
					#include "gtest/gtest.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#define WIN32_LEAN_AND_MEAN
 | 
					#define WIN32_LEAN_AND_MEAN
 | 
				
			||||||
#define NOGDI
 | 
					#define NOGDI
 | 
				
			||||||
#include <windows.h>
 | 
					#include <windows.h>
 | 
				
			||||||
| 
						 | 
					@ -61,7 +61,7 @@ TEST(CrashRecoveryTest, Cleanup) {
 | 
				
			||||||
  EXPECT_EQ(1, GlobalInt);
 | 
					  EXPECT_EQ(1, GlobalInt);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
static void raiseIt() {
 | 
					static void raiseIt() {
 | 
				
			||||||
  RaiseException(123, EXCEPTION_NONCONTINUABLE, 0, NULL);
 | 
					  RaiseException(123, EXCEPTION_NONCONTINUABLE, 0, NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,7 +23,7 @@
 | 
				
			||||||
#include "gtest/gtest.h"
 | 
					#include "gtest/gtest.h"
 | 
				
			||||||
#include "gmock/gmock.h"
 | 
					#include "gmock/gmock.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#include "llvm/ADT/ArrayRef.h"
 | 
					#include "llvm/ADT/ArrayRef.h"
 | 
				
			||||||
#include <windows.h>
 | 
					#include <windows.h>
 | 
				
			||||||
#include <winerror.h>
 | 
					#include <winerror.h>
 | 
				
			||||||
| 
						 | 
					@ -59,7 +59,7 @@ TEST(is_separator, Works) {
 | 
				
			||||||
  EXPECT_TRUE(path::is_separator('\\', path::Style::windows));
 | 
					  EXPECT_TRUE(path::is_separator('\\', path::Style::windows));
 | 
				
			||||||
  EXPECT_FALSE(path::is_separator('\\', path::Style::posix));
 | 
					  EXPECT_FALSE(path::is_separator('\\', path::Style::posix));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
  EXPECT_TRUE(path::is_separator('\\'));
 | 
					  EXPECT_TRUE(path::is_separator('\\'));
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
  EXPECT_FALSE(path::is_separator('\\'));
 | 
					  EXPECT_FALSE(path::is_separator('\\'));
 | 
				
			||||||
| 
						 | 
					@ -259,7 +259,7 @@ TEST(Support, AbsolutePathIteratorEnd) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(Support, HomeDirectory) {
 | 
					TEST(Support, HomeDirectory) {
 | 
				
			||||||
  std::string expected;
 | 
					  std::string expected;
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
  if (wchar_t const *path = ::_wgetenv(L"USERPROFILE")) {
 | 
					  if (wchar_t const *path = ::_wgetenv(L"USERPROFILE")) {
 | 
				
			||||||
    auto pathLen = ::wcslen(path);
 | 
					    auto pathLen = ::wcslen(path);
 | 
				
			||||||
    ArrayRef<char> ref{reinterpret_cast<char const *>(path),
 | 
					    ArrayRef<char> ref{reinterpret_cast<char const *>(path),
 | 
				
			||||||
| 
						 | 
					@ -348,7 +348,7 @@ TEST(Support, TempDirectory) {
 | 
				
			||||||
  EXPECT_TRUE(!TempDir.empty());
 | 
					  EXPECT_TRUE(!TempDir.empty());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
static std::string path2regex(std::string Path) {
 | 
					static std::string path2regex(std::string Path) {
 | 
				
			||||||
  size_t Pos = 0;
 | 
					  size_t Pos = 0;
 | 
				
			||||||
  while ((Pos = Path.find('\\', Pos)) != std::string::npos) {
 | 
					  while ((Pos = Path.find('\\', Pos)) != std::string::npos) {
 | 
				
			||||||
| 
						 | 
					@ -617,7 +617,7 @@ TEST_F(FileSystemTest, TempFiles) {
 | 
				
			||||||
  ASSERT_EQ(fs::access(Twine(TempPath), sys::fs::AccessMode::Exist),
 | 
					  ASSERT_EQ(fs::access(Twine(TempPath), sys::fs::AccessMode::Exist),
 | 
				
			||||||
            errc::no_such_file_or_directory);
 | 
					            errc::no_such_file_or_directory);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
  // Path name > 260 chars should get an error.
 | 
					  // Path name > 260 chars should get an error.
 | 
				
			||||||
  const char *Path270 =
 | 
					  const char *Path270 =
 | 
				
			||||||
    "abcdefghijklmnopqrstuvwxyz9abcdefghijklmnopqrstuvwxyz8"
 | 
					    "abcdefghijklmnopqrstuvwxyz9abcdefghijklmnopqrstuvwxyz8"
 | 
				
			||||||
| 
						 | 
					@ -665,7 +665,7 @@ TEST_F(FileSystemTest, CreateDir) {
 | 
				
			||||||
  ::umask(OldUmask);
 | 
					  ::umask(OldUmask);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
  // Prove that create_directories() can handle a pathname > 248 characters,
 | 
					  // Prove that create_directories() can handle a pathname > 248 characters,
 | 
				
			||||||
  // which is the documented limit for CreateDirectory().
 | 
					  // which is the documented limit for CreateDirectory().
 | 
				
			||||||
  // (248 is MAX_PATH subtracting room for an 8.3 filename.)
 | 
					  // (248 is MAX_PATH subtracting room for an 8.3 filename.)
 | 
				
			||||||
| 
						 | 
					@ -958,7 +958,7 @@ TEST_F(FileSystemTest, Remove) {
 | 
				
			||||||
  ASSERT_FALSE(fs::exists(BaseDir));
 | 
					  ASSERT_FALSE(fs::exists(BaseDir));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
TEST_F(FileSystemTest, CarriageReturn) {
 | 
					TEST_F(FileSystemTest, CarriageReturn) {
 | 
				
			||||||
  SmallString<128> FilePathname(TestDirectory);
 | 
					  SmallString<128> FilePathname(TestDirectory);
 | 
				
			||||||
  std::error_code EC;
 | 
					  std::error_code EC;
 | 
				
			||||||
| 
						 | 
					@ -1076,7 +1076,7 @@ TEST(Support, NormalizePath) {
 | 
				
			||||||
    EXPECT_EQ(std::get<2>(T), Posix);
 | 
					    EXPECT_EQ(std::get<2>(T), Posix);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(LLVM_ON_WIN32)
 | 
					#if defined(_WIN32)
 | 
				
			||||||
  SmallString<64> PathHome;
 | 
					  SmallString<64> PathHome;
 | 
				
			||||||
  path::home_directory(PathHome);
 | 
					  path::home_directory(PathHome);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1256,7 +1256,7 @@ TEST_F(FileSystemTest, permissions) {
 | 
				
			||||||
  EXPECT_EQ(fs::setPermissions(TempPath, fs::all_read | fs::all_exe), NoError);
 | 
					  EXPECT_EQ(fs::setPermissions(TempPath, fs::all_read | fs::all_exe), NoError);
 | 
				
			||||||
  EXPECT_TRUE(CheckPermissions(fs::all_read | fs::all_exe));
 | 
					  EXPECT_TRUE(CheckPermissions(fs::all_read | fs::all_exe));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(LLVM_ON_WIN32)
 | 
					#if defined(_WIN32)
 | 
				
			||||||
  fs::perms ReadOnly = fs::all_read | fs::all_exe;
 | 
					  fs::perms ReadOnly = fs::all_read | fs::all_exe;
 | 
				
			||||||
  EXPECT_EQ(fs::setPermissions(TempPath, fs::no_perms), NoError);
 | 
					  EXPECT_EQ(fs::setPermissions(TempPath, fs::no_perms), NoError);
 | 
				
			||||||
  EXPECT_TRUE(CheckPermissions(ReadOnly));
 | 
					  EXPECT_TRUE(CheckPermissions(ReadOnly));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,7 +10,7 @@
 | 
				
			||||||
#include "llvm/Support/Process.h"
 | 
					#include "llvm/Support/Process.h"
 | 
				
			||||||
#include "gtest/gtest.h"
 | 
					#include "gtest/gtest.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#include <windows.h>
 | 
					#include <windows.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,7 +45,7 @@ TEST(ProcessTest, None) {
 | 
				
			||||||
} 
 | 
					} 
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(ProcessTest, EmptyVal) {
 | 
					TEST(ProcessTest, EmptyVal) {
 | 
				
			||||||
  SetEnvironmentVariableA("__LLVM_TEST_ENVIRON_VAR__", "");
 | 
					  SetEnvironmentVariableA("__LLVM_TEST_ENVIRON_VAR__", "");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,7 +26,7 @@ extern char **environ;
 | 
				
			||||||
void sleep_for(unsigned int seconds) {
 | 
					void sleep_for(unsigned int seconds) {
 | 
				
			||||||
  sleep(seconds);
 | 
					  sleep(seconds);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#elif defined(LLVM_ON_WIN32)
 | 
					#elif defined(_WIN32)
 | 
				
			||||||
#include <windows.h>
 | 
					#include <windows.h>
 | 
				
			||||||
void sleep_for(unsigned int seconds) {
 | 
					void sleep_for(unsigned int seconds) {
 | 
				
			||||||
  Sleep(seconds * 1000);
 | 
					  Sleep(seconds * 1000);
 | 
				
			||||||
| 
						 | 
					@ -65,7 +65,7 @@ class ProgramEnvTest : public testing::Test {
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
  void SetUp() override {
 | 
					  void SetUp() override {
 | 
				
			||||||
    auto EnvP = [] {
 | 
					    auto EnvP = [] {
 | 
				
			||||||
#if defined(LLVM_ON_WIN32)
 | 
					#if defined(_WIN32)
 | 
				
			||||||
      _wgetenv(L"TMP"); // Populate _wenviron, initially is null
 | 
					      _wgetenv(L"TMP"); // Populate _wenviron, initially is null
 | 
				
			||||||
      return _wenviron;
 | 
					      return _wenviron;
 | 
				
			||||||
#elif defined(__APPLE__)
 | 
					#elif defined(__APPLE__)
 | 
				
			||||||
| 
						 | 
					@ -77,7 +77,7 @@ protected:
 | 
				
			||||||
    ASSERT_TRUE(EnvP);
 | 
					    ASSERT_TRUE(EnvP);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    auto prepareEnvVar = [this](decltype(*EnvP) Var) {
 | 
					    auto prepareEnvVar = [this](decltype(*EnvP) Var) {
 | 
				
			||||||
#if defined(LLVM_ON_WIN32)
 | 
					#if defined(_WIN32)
 | 
				
			||||||
      // On Windows convert UTF16 encoded variable to UTF8
 | 
					      // On Windows convert UTF16 encoded variable to UTF8
 | 
				
			||||||
      auto Len = wcslen(Var);
 | 
					      auto Len = wcslen(Var);
 | 
				
			||||||
      ArrayRef<char> Ref{reinterpret_cast<char const *>(Var),
 | 
					      ArrayRef<char> Ref{reinterpret_cast<char const *>(Var),
 | 
				
			||||||
| 
						 | 
					@ -115,7 +115,7 @@ protected:
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
TEST_F(ProgramEnvTest, CreateProcessLongPath) {
 | 
					TEST_F(ProgramEnvTest, CreateProcessLongPath) {
 | 
				
			||||||
  if (getenv("LLVM_PROGRAM_TEST_LONG_PATH"))
 | 
					  if (getenv("LLVM_PROGRAM_TEST_LONG_PATH"))
 | 
				
			||||||
    exit(0);
 | 
					    exit(0);
 | 
				
			||||||
| 
						 | 
					@ -186,7 +186,7 @@ TEST_F(ProgramEnvTest, CreateProcessTrailingSlash) {
 | 
				
			||||||
  std::string error;
 | 
					  std::string error;
 | 
				
			||||||
  bool ExecutionFailed;
 | 
					  bool ExecutionFailed;
 | 
				
			||||||
  // Redirect stdout and stdin to NUL, but let stderr through.
 | 
					  // Redirect stdout and stdin to NUL, but let stderr through.
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
  StringRef nul("NUL");
 | 
					  StringRef nul("NUL");
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
  StringRef nul("/dev/null");
 | 
					  StringRef nul("/dev/null");
 | 
				
			||||||
| 
						 | 
					@ -312,7 +312,7 @@ TEST(ProgramTest, TestExecuteNegative) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LLVM_ON_WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
const char utf16le_text[] =
 | 
					const char utf16le_text[] =
 | 
				
			||||||
    "\x6c\x00\x69\x00\x6e\x00\x67\x00\xfc\x00\x69\x00\xe7\x00\x61\x00";
 | 
					    "\x6c\x00\x69\x00\x6e\x00\x67\x00\xfc\x00\x69\x00\xe7\x00\x61\x00";
 | 
				
			||||||
const char utf16be_text[] =
 | 
					const char utf16be_text[] =
 | 
				
			||||||
| 
						 | 
					@ -332,7 +332,7 @@ TEST(ProgramTest, TestWriteWithSystemEncoding) {
 | 
				
			||||||
                                             sys::WEM_UTF16));
 | 
					                                             sys::WEM_UTF16));
 | 
				
			||||||
  int fd = 0;
 | 
					  int fd = 0;
 | 
				
			||||||
  ASSERT_NO_ERROR(fs::openFileForRead(file_pathname.c_str(), fd));
 | 
					  ASSERT_NO_ERROR(fs::openFileForRead(file_pathname.c_str(), fd));
 | 
				
			||||||
#if defined(LLVM_ON_WIN32)
 | 
					#if defined(_WIN32)
 | 
				
			||||||
  char buf[18];
 | 
					  char buf[18];
 | 
				
			||||||
  ASSERT_EQ(::read(fd, buf, 18), 18);
 | 
					  ASSERT_EQ(::read(fd, buf, 18), 18);
 | 
				
			||||||
  if (strncmp(buf, "\xfe\xff", 2) == 0) { // UTF16-BE
 | 
					  if (strncmp(buf, "\xfe\xff", 2) == 0) { // UTF16-BE
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,7 +10,7 @@
 | 
				
			||||||
#include "llvm/Support/Timer.h"
 | 
					#include "llvm/Support/Timer.h"
 | 
				
			||||||
#include "gtest/gtest.h"
 | 
					#include "gtest/gtest.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if LLVM_ON_WIN32
 | 
					#if _WIN32
 | 
				
			||||||
#include <windows.h>
 | 
					#include <windows.h>
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#include <time.h>
 | 
					#include <time.h>
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,7 @@ namespace {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// FIXME: Put this somewhere in Support, it's also used in LockFileManager.
 | 
					// FIXME: Put this somewhere in Support, it's also used in LockFileManager.
 | 
				
			||||||
void SleepMS() {
 | 
					void SleepMS() {
 | 
				
			||||||
#if LLVM_ON_WIN32
 | 
					#if _WIN32
 | 
				
			||||||
  Sleep(1);
 | 
					  Sleep(1);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
  struct timespec Interval;
 | 
					  struct timespec Interval;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue