class of operating system. Currently only Unix and Win32 classes are defined
but more could be added for other operating system classifications. To
distinguish which implementation to compile, the code in ``lib/System`` uses
-the ``LLVM_ON_UNIX`` and ``LLVM_ON_WIN32`` ``#defines`` provided via configure
-through the ``llvm/Config/config.h`` file. Each source file in ``lib/System``,
-after implementing the generic (operating system independent) functionality
-needs to include the correct implementation using a set of
+the ``LLVM_ON_UNIX`` and ``_WIN32`` ``#defines``. Each source file in
+``lib/System``, after implementing the generic (operating system independent)
+functionality needs to include the correct implementation using a set of
``#if defined(LLVM_ON_XYZ)`` directives. For example, if we had
``lib/System/File.cpp``, we'd expect to see in that file:
#if defined(LLVM_ON_UNIX)
#include "Unix/File.cpp"
#endif
- #if defined(LLVM_ON_WIN32)
+ #if defined(_WIN32)
#include "Win32/File.cpp"
#endif
.. code-block:: c++
- #ifdef LLVM_ON_WIN32
+ #ifdef _WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
// "Library" functions that can be "extern'd" from user code.
//===----------------------------------------------------------------------===//
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
// "Library" functions that can be "extern'd" from user code.
//===----------------------------------------------------------------------===//
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
// "Library" functions that can be "extern'd" from user code.
//===----------------------------------------------------------------------===//
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
// "Library" functions that can be "extern'd" from user code.
//===----------------------------------------------------------------------===//
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
// "Library" functions that can be "extern'd" from user code.
//===----------------------------------------------------------------------===//
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
// "Library" functions that can be "extern'd" from user code.
//===----------------------------------------------------------------------===//
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
}
JITSymbol findMangledSymbol(const std::string &Name) {
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
// The symbol lookup of ObjectLinkingLayer uses the SymbolRef::SF_Exported
// flag to decide whether a symbol will be visible or not, when we call
// IRCompileLayer::findSymbolIn with ExportedSymbolsOnly set to true.
if (auto SymAddr = RTDyldMemoryManager::getSymbolAddressInProcess(Name))
return JITSymbol(SymAddr, JITSymbolFlags::Exported);
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
// For Windows retry without "_" at beginning, as RTDyldMemoryManager uses
// GetProcAddress and standard libraries like msvcrt.dll use names
// with and without "_" (for example "_itoa" but "sin").
uid_t fs_st_uid = 0;
gid_t fs_st_gid = 0;
off_t fs_st_size = 0;
- #elif defined (LLVM_ON_WIN32)
+ #elif defined (_WIN32)
uint32_t LastAccessedTimeHigh = 0;
uint32_t LastAccessedTimeLow = 0;
uint32_t LastWriteTimeHigh = 0;
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_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,
uint32_t LastAccessTimeLow, uint32_t LastWriteTimeHigh,
uint32_t LastWriteTimeLow, uint32_t FileSizeHigh,
uint32_t getUser() const { return fs_st_uid; }
uint32_t getGroup() const { return fs_st_gid; }
uint64_t getSize() const { return fs_st_size; }
- #elif defined (LLVM_ON_WIN32)
+ #elif defined (_WIN32)
uint32_t getUser() const {
return 9999; // Not applicable to Windows, so...
}
dev_t fs_st_dev = 0;
nlink_t fs_st_nlinks = 0;
ino_t fs_st_ino = 0;
- #elif defined (LLVM_ON_WIN32)
+ #elif defined (_WIN32)
uint32_t NumLinks = 0;
uint32_t VolumeSerialNumber = 0;
uint32_t FileIndexHigh = 0;
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),
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,
uint32_t LastAccessTimeHigh, uint32_t LastAccessTimeLow,
uint32_t LastWriteTimeHigh, uint32_t LastWriteTimeLow,
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#else
-#if !defined(BYTE_ORDER) && !defined(LLVM_ON_WIN32)
+#if !defined(BYTE_ORDER) && !defined(_WIN32)
#include <machine/endian.h>
#endif
#endif
// a colon on Unix or a semicolon on Windows.
#if defined(LLVM_ON_UNIX)
const char EnvPathSeparator = ':';
-#elif defined (LLVM_ON_WIN32)
+#elif defined (_WIN32)
const char EnvPathSeparator = ';';
#endif
struct ProcessInfo {
#if defined(LLVM_ON_UNIX)
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 void * HANDLE; // Must match the type of HANDLE on Windows.
/// The handle to the process (available on Windows only).
for (auto ToE = sys::path::end(To); ToI != ToE; ++ToI)
sys::path::append(Relative, *ToI);
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
// Replace backslashes with slashes so that the path is portable between *nix
// and Windows.
std::replace(Relative.begin(), Relative.end(), '\\', '/');
// Include the platform-specific parts of this class.
#ifdef LLVM_ON_UNIX
#include "Unix/COM.inc"
-#elif LLVM_ON_WIN32
+#elif _WIN32
#include "Windows/COM.inc"
#endif
assert(LT);
(void)LT;
#endif
-#if defined(LLVM_ON_WIN32)
+#if defined(_WIN32)
int Error = ::localtime_s(&Storage, &OurTime);
assert(!Error);
(void)Error;
#if LLVM_ON_UNIX
#include <unistd.h>
-#elif LLVM_ON_WIN32
+#elif _WIN32
#include <windows.h>
#endif
std::string Pid =
#if LLVM_ON_UNIX
llvm::to_string(::getpid());
-#elif LLVM_ON_WIN32
+#elif _WIN32
llvm::to_string(::GetCurrentProcessId());
#else
"";
#else // !_MSC_VER
-#if defined(LLVM_ON_WIN32)
+#if defined(_WIN32)
// This is a non-MSVC compiler, probably mingw gcc or clang without
// -fms-extensions. Use vectored exception handling (VEH).
//
}
}
-#else // !LLVM_ON_WIN32
+#else // !_WIN32
// Generic POSIX implementation.
//
sigaction(Signals[i], &PrevActions[i], nullptr);
}
-#endif // !LLVM_ON_WIN32
+#endif // !_WIN32
bool CrashRecoveryContext::RunSafely(function_ref<void()> Fn) {
// If crash recovery is disabled, do nothing.
}
bool AddLibrary(void *Handle, bool IsProcess = false, bool CanClose = true) {
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
assert((Handle == this ? IsProcess : !IsProcess) && "Bad Handle.");
#endif
}
Handles.push_back(Handle);
} else {
-#ifndef LLVM_ON_WIN32
+#ifndef _WIN32
if (Process) {
if (CanClose)
DLClose(Process);
static llvm::ManagedStatic<llvm::sys::SmartMutex<true>> SymbolsMutex;
}
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#include "Windows/DynamicLibrary.inc"
remove_fatal_error_handler();
}
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#include <winerror.h>
return FileOrErr.takeError();
fs::TempFile File = std::move(*FileOrErr);
-#ifndef LLVM_ON_WIN32
+#ifndef _WIN32
// On Windows, CreateFileMapping (the mmap function on Windows)
// automatically extends the underlying file. We don't need to
// extend the file beforehand. _chsize (ftruncate on Windows) is
Viewer = VK_Ghostview;
if (!Viewer && S.TryFindProgram("xdg-open", ViewerPath))
Viewer = VK_XDGOpen;
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
if (!Viewer && S.TryFindProgram("cmd", ViewerPath)) {
Viewer = VK_CmdStart;
}
args.push_back(nullptr);
// Dotty spawns another app and doesn't wait until it returns
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
wait = false;
#endif
errs() << "Running 'dotty' program... ";
#ifdef LLVM_ON_UNIX
#include "Unix/Host.inc"
#endif
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#include "Windows/Host.inc"
#endif
#ifdef _MSC_VER
namespace locale {
int columnWidth(StringRef Text) {
-#if LLVM_ON_WIN32
+#if _WIN32
return Text.size();
#else
return llvm::sys::unicode::columnWidthUTF8(Text);
}
bool isPrint(int UCS) {
-#if LLVM_ON_WIN32
+#if _WIN32
// 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
// reliably output code points U+0080 and higher using narrow character C/C++
#include <sys/types.h>
#include <system_error>
#include <tuple>
-#if LLVM_ON_WIN32
+#if _WIN32
#include <windows.h>
#endif
#if LLVM_ON_UNIX
if (getState() != LFS_Shared)
return Res_Success;
-#if LLVM_ON_WIN32
+#if _WIN32
unsigned long Interval = 1;
#else
struct timespec Interval;
// finish up and remove the lock file.
// FIXME: Should we hook in to system APIs to get a notification when the
// lock file is deleted?
-#if LLVM_ON_WIN32
+#if _WIN32
Sleep(Interval);
#else
nanosleep(&Interval, nullptr);
return Res_OwnerDied;
// Exponentially increase the time we wait for the lock to be removed.
-#if LLVM_ON_WIN32
+#if _WIN32
Interval *= 2;
#else
Interval.tv_sec *= 2;
}
#endif
} while (
-#if LLVM_ON_WIN32
+#if _WIN32
Interval < MaxSeconds * 1000
#else
Interval.tv_sec < (time_t)MaxSeconds
#ifdef LLVM_ON_UNIX
#include "Unix/Memory.inc"
#endif
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#include "Windows/Memory.inc"
#endif
#elif defined(LLVM_ON_UNIX)
#include "Unix/Mutex.inc"
-#elif defined( LLVM_ON_WIN32)
+#elif defined( _WIN32)
#include "Windows/Mutex.inc"
#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
using llvm::sys::path::Style;
inline Style real_style(Style style) {
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
return (style == Style::posix) ? Style::posix : Style::windows;
#else
return (style == Style::windows) ? Style::windows : Style::posix;
#if defined(LLVM_ON_UNIX)
#include "Unix/Path.inc"
#endif
-#if defined(LLVM_ON_WIN32)
+#if defined(_WIN32)
#include "Windows/Path.inc"
#endif
Done = true;
std::error_code RemoveEC;
// On windows closing will remove the file.
-#ifndef LLVM_ON_WIN32
+#ifndef _WIN32
// Always try to close and remove.
if (!TmpName.empty()) {
RemoveEC = fs::remove(TmpName);
assert(!Done);
Done = true;
// Always try to close and rename.
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
// If we cant't cancel the delete don't rename.
std::error_code RenameEC = cancelDeleteOnClose(FD);
if (!RenameEC)
assert(!Done);
Done = true;
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
if (std::error_code EC = cancelDeleteOnClose(FD))
return errorCodeToError(EC);
#else
return errorCodeToError(EC);
TempFile Ret(ResultPath, FD);
-#ifndef LLVM_ON_WIN32
+#ifndef _WIN32
if (sys::RemoveFileOnSignal(ResultPath)) {
// Make sure we delete the file when RemoveFileOnSignal fails.
consumeError(Ret.discard());
#ifdef LLVM_ON_UNIX
#include "Unix/Process.inc"
#endif
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#include "Windows/Process.inc"
#endif
#ifdef LLVM_ON_UNIX
#include "Unix/Program.inc"
#endif
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#include "Windows/Program.inc"
#endif
#elif defined(LLVM_ON_UNIX)
#include "Unix/RWMutex.inc"
-#elif defined( LLVM_ON_WIN32)
+#elif defined( _WIN32)
#include "Windows/RWMutex.inc"
#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
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#include "Windows/WindowsSupport.h"
#else
#include "Unix/Unix.h"
// Get random vector of specified size
std::error_code llvm::getRandomBytes(void *Buffer, size_t Size) {
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
HCRYPTPROV hProvider;
if (CryptAcquireContext(&hProvider, 0, 0, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
Optional<StringRef> Redirects[] = {InputFile.str(), OutputFile.str(), llvm::None};
const char *Args[] = {"llvm-symbolizer", "--functions=linkage", "--inlining",
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
// Pass --relative-address on Windows so that we don't
// have to add ImageBase from PE file.
// FIXME: Make this the default for llvm-symbolizer.
#ifdef LLVM_ON_UNIX
#include "Unix/Signals.inc"
#endif
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#include "Windows/Signals.inc"
#endif
}
#elif defined(LLVM_ON_UNIX)
#include "Unix/ThreadLocal.inc"
-#elif defined( LLVM_ON_WIN32)
+#elif defined( _WIN32)
#include "Windows/ThreadLocal.inc"
#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
}
#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.
void llvm::llvm_execute_on_thread(void (*Fn)(void *), void *UserData,
unsigned RequestedStackSize) {
#ifdef LLVM_ON_UNIX
#include "Unix/Threading.inc"
#endif
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#include "Windows/Threading.inc"
#endif
return uint64_t(gettid());
#elif defined(__linux__)
return uint64_t(syscall(SYS_gettid));
-#elif defined(LLVM_ON_WIN32)
+#elif defined(_WIN32)
return uint64_t(::GetCurrentThreadId());
#else
return uint64_t(pthread_self());
#ifdef LLVM_ON_UNIX
#include "Unix/Watchdog.inc"
#endif
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#include "Windows/Watchdog.inc"
#endif
#endif
#endif
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#include "Windows/WindowsSupport.h"
#endif
// Get the starting position.
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.
sys::fs::file_status Status;
std::error_code EC = status(FD, Status);
// It is observed that Linux returns EINVAL for a very large write (>2G).
// Make it a reasonably small value.
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
// 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).
uint64_t raw_fd_ostream::seek(uint64_t off) {
assert(SupportsSeeking && "Stream does not support seeking!");
flush();
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
pos = ::_lseeki64(FD, off, SEEK_SET);
#elif defined(HAVE_LSEEK64)
pos = ::lseek64(FD, off, SEEK_SET);
#if defined(LLVM_ON_UNIX)
const char EXESuffix[] = "";
-#elif defined(LLVM_ON_WIN32)
+#elif defined(_WIN32)
const char EXESuffix[] = "exe";
#endif
// Initialize the configured targets if they have not been initialized.
static void lto_initialize() {
if (!initialized) {
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
// Dialog box on crash disabling doesn't work across DLL boundaries, so do
// it here.
llvm::sys::DisableSystemDialogsOnCrash();
// fail to initialize the AssumptionCacheTracker.
initializeAssumptionCacheTrackerPass(*PassRegistry::getPassRegistry());
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
// On Windows, generate ELF objects by specifying "-elf" in triple
HostTriple += "-elf";
-#endif // LLVM_ON_WIN32
+#endif // _WIN32
HostTriple = Triple::normalize(HostTriple);
}
static MutexT *getMutex(const ExtraData &Data) { return Data.M; }
};
// 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) {
sys::Mutex M(false); // Not recursive.
bool CalledRAUW = false, CalledDeleted = false;
#include "llvm/Support/CrashRecoveryContext.h"
#include "gtest/gtest.h"
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#define NOGDI
#include <windows.h>
EXPECT_EQ(1, GlobalInt);
}
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
static void raiseIt() {
RaiseException(123, EXCEPTION_NONCONTINUABLE, 0, NULL);
}
#include "gtest/gtest.h"
#include "gmock/gmock.h"
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#include "llvm/ADT/ArrayRef.h"
#include <windows.h>
#include <winerror.h>
EXPECT_TRUE(path::is_separator('\\', path::Style::windows));
EXPECT_FALSE(path::is_separator('\\', path::Style::posix));
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
EXPECT_TRUE(path::is_separator('\\'));
#else
EXPECT_FALSE(path::is_separator('\\'));
TEST(Support, HomeDirectory) {
std::string expected;
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
if (wchar_t const *path = ::_wgetenv(L"USERPROFILE")) {
auto pathLen = ::wcslen(path);
ArrayRef<char> ref{reinterpret_cast<char const *>(path),
EXPECT_TRUE(!TempDir.empty());
}
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
static std::string path2regex(std::string Path) {
size_t Pos = 0;
while ((Pos = Path.find('\\', Pos)) != std::string::npos) {
ASSERT_EQ(fs::access(Twine(TempPath), sys::fs::AccessMode::Exist),
errc::no_such_file_or_directory);
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
// Path name > 260 chars should get an error.
const char *Path270 =
"abcdefghijklmnopqrstuvwxyz9abcdefghijklmnopqrstuvwxyz8"
::umask(OldUmask);
#endif
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
// Prove that create_directories() can handle a pathname > 248 characters,
// which is the documented limit for CreateDirectory().
// (248 is MAX_PATH subtracting room for an 8.3 filename.)
ASSERT_FALSE(fs::exists(BaseDir));
}
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
TEST_F(FileSystemTest, CarriageReturn) {
SmallString<128> FilePathname(TestDirectory);
std::error_code EC;
EXPECT_EQ(std::get<2>(T), Posix);
}
-#if defined(LLVM_ON_WIN32)
+#if defined(_WIN32)
SmallString<64> PathHome;
path::home_directory(PathHome);
EXPECT_EQ(fs::setPermissions(TempPath, fs::all_read | fs::all_exe), NoError);
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;
EXPECT_EQ(fs::setPermissions(TempPath, fs::no_perms), NoError);
EXPECT_TRUE(CheckPermissions(ReadOnly));
#include "llvm/Support/Process.h"
#include "gtest/gtest.h"
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#include <windows.h>
#endif
}
#endif
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
TEST(ProcessTest, EmptyVal) {
SetEnvironmentVariableA("__LLVM_TEST_ENVIRON_VAR__", "");
void sleep_for(unsigned int seconds) {
sleep(seconds);
}
-#elif defined(LLVM_ON_WIN32)
+#elif defined(_WIN32)
#include <windows.h>
void sleep_for(unsigned int seconds) {
Sleep(seconds * 1000);
protected:
void SetUp() override {
auto EnvP = [] {
-#if defined(LLVM_ON_WIN32)
+#if defined(_WIN32)
_wgetenv(L"TMP"); // Populate _wenviron, initially is null
return _wenviron;
#elif defined(__APPLE__)
ASSERT_TRUE(EnvP);
auto prepareEnvVar = [this](decltype(*EnvP) Var) {
-#if defined(LLVM_ON_WIN32)
+#if defined(_WIN32)
// On Windows convert UTF16 encoded variable to UTF8
auto Len = wcslen(Var);
ArrayRef<char> Ref{reinterpret_cast<char const *>(Var),
}
};
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
TEST_F(ProgramEnvTest, CreateProcessLongPath) {
if (getenv("LLVM_PROGRAM_TEST_LONG_PATH"))
exit(0);
std::string error;
bool ExecutionFailed;
// Redirect stdout and stdin to NUL, but let stderr through.
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
StringRef nul("NUL");
#else
StringRef nul("/dev/null");
}
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
const char utf16le_text[] =
"\x6c\x00\x69\x00\x6e\x00\x67\x00\xfc\x00\x69\x00\xe7\x00\x61\x00";
const char utf16be_text[] =
sys::WEM_UTF16));
int fd = 0;
ASSERT_NO_ERROR(fs::openFileForRead(file_pathname.c_str(), fd));
-#if defined(LLVM_ON_WIN32)
+#if defined(_WIN32)
char buf[18];
ASSERT_EQ(::read(fd, buf, 18), 18);
if (strncmp(buf, "\xfe\xff", 2) == 0) { // UTF16-BE
#include "llvm/Support/Timer.h"
#include "gtest/gtest.h"
-#if LLVM_ON_WIN32
+#if _WIN32
#include <windows.h>
#else
#include <time.h>
// FIXME: Put this somewhere in Support, it's also used in LockFileManager.
void SleepMS() {
-#if LLVM_ON_WIN32
+#if _WIN32
Sleep(1);
#else
struct timespec Interval;