diff options
author | Nico Weber <nicolasweber@gmx.de> | 2018-04-29 00:45:03 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2018-04-29 00:45:03 +0000 |
commit | 712e8d29c4a52abded4414f673b51dd53dd018f1 (patch) | |
tree | 4b99dbe86251f1a62c3aefd587e57aa540795ee6 /llvm/lib/Support | |
parent | d3d3d6b75d43c52eaa2bcbe5bab7be10ff329695 (diff) | |
download | bcm5719-llvm-712e8d29c4a52abded4414f673b51dd53dd018f1.tar.gz bcm5719-llvm-712e8d29c4a52abded4414f673b51dd53dd018f1.zip |
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
Diffstat (limited to 'llvm/lib/Support')
24 files changed, 49 insertions, 49 deletions
diff --git a/llvm/lib/Support/COM.cpp b/llvm/lib/Support/COM.cpp index cf3a133fd9b..525fbba3842 100644 --- a/llvm/lib/Support/COM.cpp +++ b/llvm/lib/Support/COM.cpp @@ -18,6 +18,6 @@ // 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 diff --git a/llvm/lib/Support/Chrono.cpp b/llvm/lib/Support/Chrono.cpp index 84f5aab6fc4..db5d77868e4 100644 --- a/llvm/lib/Support/Chrono.cpp +++ b/llvm/lib/Support/Chrono.cpp @@ -32,7 +32,7 @@ static inline struct tm getStructTM(TimePoint<> TP) { assert(LT); (void)LT; #endif -#if defined(LLVM_ON_WIN32) +#if defined(_WIN32) int Error = ::localtime_s(&Storage, &OurTime); assert(!Error); (void)Error; diff --git a/llvm/lib/Support/CodeGenCoverage.cpp b/llvm/lib/Support/CodeGenCoverage.cpp index 4948f1348fc..4114cfcc9a6 100644 --- a/llvm/lib/Support/CodeGenCoverage.cpp +++ b/llvm/lib/Support/CodeGenCoverage.cpp @@ -22,7 +22,7 @@ #if LLVM_ON_UNIX #include <unistd.h> -#elif LLVM_ON_WIN32 +#elif _WIN32 #include <windows.h> #endif @@ -93,7 +93,7 @@ bool CodeGenCoverage::emit(StringRef CoveragePrefix, std::string Pid = #if LLVM_ON_UNIX llvm::to_string(::getpid()); -#elif LLVM_ON_WIN32 +#elif _WIN32 llvm::to_string(::GetCurrentProcessId()); #else ""; diff --git a/llvm/lib/Support/CrashRecoveryContext.cpp b/llvm/lib/Support/CrashRecoveryContext.cpp index bd38dd88201..f3894408bad 100644 --- a/llvm/lib/Support/CrashRecoveryContext.cpp +++ b/llvm/lib/Support/CrashRecoveryContext.cpp @@ -189,7 +189,7 @@ bool CrashRecoveryContext::RunSafely(function_ref<void()> Fn) { #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). // @@ -272,7 +272,7 @@ static void uninstallExceptionOrSignalHandlers() { } } -#else // !LLVM_ON_WIN32 +#else // !_WIN32 // Generic POSIX implementation. // @@ -342,7 +342,7 @@ static void uninstallExceptionOrSignalHandlers() { 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. diff --git a/llvm/lib/Support/DynamicLibrary.cpp b/llvm/lib/Support/DynamicLibrary.cpp index d8422115eae..530e92d99a9 100644 --- a/llvm/lib/Support/DynamicLibrary.cpp +++ b/llvm/lib/Support/DynamicLibrary.cpp @@ -49,7 +49,7 @@ public: } bool AddLibrary(void *Handle, bool IsProcess = false, bool CanClose = true) { -#ifdef LLVM_ON_WIN32 +#ifdef _WIN32 assert((Handle == this ? IsProcess : !IsProcess) && "Bad Handle."); #endif @@ -61,7 +61,7 @@ public: } Handles.push_back(Handle); } else { -#ifndef LLVM_ON_WIN32 +#ifndef _WIN32 if (Process) { if (CanClose) DLClose(Process); @@ -121,7 +121,7 @@ static llvm::ManagedStatic<DynamicLibrary::HandleSet> OpenedHandles; static llvm::ManagedStatic<llvm::sys::SmartMutex<true>> SymbolsMutex; } -#ifdef LLVM_ON_WIN32 +#ifdef _WIN32 #include "Windows/DynamicLibrary.inc" diff --git a/llvm/lib/Support/ErrorHandling.cpp b/llvm/lib/Support/ErrorHandling.cpp index cb14749cc42..21712c5c039 100644 --- a/llvm/lib/Support/ErrorHandling.cpp +++ b/llvm/lib/Support/ErrorHandling.cpp @@ -243,7 +243,7 @@ void LLVMResetFatalErrorHandler() { remove_fatal_error_handler(); } -#ifdef LLVM_ON_WIN32 +#ifdef _WIN32 #include <winerror.h> diff --git a/llvm/lib/Support/FileOutputBuffer.cpp b/llvm/lib/Support/FileOutputBuffer.cpp index c4ff563e5f4..cd08b61d0d6 100644 --- a/llvm/lib/Support/FileOutputBuffer.cpp +++ b/llvm/lib/Support/FileOutputBuffer.cpp @@ -115,7 +115,7 @@ createOnDiskBuffer(StringRef Path, size_t Size, unsigned Mode) { 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 diff --git a/llvm/lib/Support/GraphWriter.cpp b/llvm/lib/Support/GraphWriter.cpp index fd7fab08278..3718affa81d 100644 --- a/llvm/lib/Support/GraphWriter.cpp +++ b/llvm/lib/Support/GraphWriter.cpp @@ -221,7 +221,7 @@ bool llvm::DisplayGraph(StringRef FilenameRef, bool wait, 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; } @@ -296,7 +296,7 @@ bool llvm::DisplayGraph(StringRef FilenameRef, bool wait, 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... "; diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp index 5a55e555f9c..f480a2491b1 100644 --- a/llvm/lib/Support/Host.cpp +++ b/llvm/lib/Support/Host.cpp @@ -30,7 +30,7 @@ #ifdef LLVM_ON_UNIX #include "Unix/Host.inc" #endif -#ifdef LLVM_ON_WIN32 +#ifdef _WIN32 #include "Windows/Host.inc" #endif #ifdef _MSC_VER diff --git a/llvm/lib/Support/Locale.cpp b/llvm/lib/Support/Locale.cpp index e24a28be430..19e9ca92579 100644 --- a/llvm/lib/Support/Locale.cpp +++ b/llvm/lib/Support/Locale.cpp @@ -8,7 +8,7 @@ namespace sys { namespace locale { int columnWidth(StringRef Text) { -#if LLVM_ON_WIN32 +#if _WIN32 return Text.size(); #else return llvm::sys::unicode::columnWidthUTF8(Text); @@ -16,7 +16,7 @@ int columnWidth(StringRef 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++ diff --git a/llvm/lib/Support/LockFileManager.cpp b/llvm/lib/Support/LockFileManager.cpp index 74cb8fea408..4f7ebd408fe 100644 --- a/llvm/lib/Support/LockFileManager.cpp +++ b/llvm/lib/Support/LockFileManager.cpp @@ -25,7 +25,7 @@ #include <sys/types.h> #include <system_error> #include <tuple> -#if LLVM_ON_WIN32 +#if _WIN32 #include <windows.h> #endif #if LLVM_ON_UNIX @@ -258,7 +258,7 @@ LockFileManager::WaitForUnlockResult LockFileManager::waitForUnlock() { if (getState() != LFS_Shared) return Res_Success; -#if LLVM_ON_WIN32 +#if _WIN32 unsigned long Interval = 1; #else struct timespec Interval; @@ -273,7 +273,7 @@ LockFileManager::WaitForUnlockResult LockFileManager::waitForUnlock() { // 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); @@ -292,7 +292,7 @@ LockFileManager::WaitForUnlockResult LockFileManager::waitForUnlock() { 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; @@ -303,7 +303,7 @@ LockFileManager::WaitForUnlockResult LockFileManager::waitForUnlock() { } #endif } while ( -#if LLVM_ON_WIN32 +#if _WIN32 Interval < MaxSeconds * 1000 #else Interval.tv_sec < (time_t)MaxSeconds diff --git a/llvm/lib/Support/Memory.cpp b/llvm/lib/Support/Memory.cpp index f9a4903ad01..3ba0d5e0ccc 100644 --- a/llvm/lib/Support/Memory.cpp +++ b/llvm/lib/Support/Memory.cpp @@ -20,6 +20,6 @@ #ifdef LLVM_ON_UNIX #include "Unix/Memory.inc" #endif -#ifdef LLVM_ON_WIN32 +#ifdef _WIN32 #include "Windows/Memory.inc" #endif diff --git a/llvm/lib/Support/Mutex.cpp b/llvm/lib/Support/Mutex.cpp index b1d5e7c0d99..be501e8d0d7 100644 --- a/llvm/lib/Support/Mutex.cpp +++ b/llvm/lib/Support/Mutex.cpp @@ -119,9 +119,9 @@ MutexImpl::tryacquire() #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 diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp index ec8a5ca98e5..b73c4562771 100644 --- a/llvm/lib/Support/Path.cpp +++ b/llvm/lib/Support/Path.cpp @@ -37,7 +37,7 @@ namespace { 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; @@ -1073,7 +1073,7 @@ ErrorOr<perms> getPermissions(const Twine &Path) { #if defined(LLVM_ON_UNIX) #include "Unix/Path.inc" #endif -#if defined(LLVM_ON_WIN32) +#if defined(_WIN32) #include "Windows/Path.inc" #endif @@ -1095,7 +1095,7 @@ Error TempFile::discard() { 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); @@ -1119,7 +1119,7 @@ Error TempFile::keep(const Twine &Name) { 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) @@ -1151,7 +1151,7 @@ Error TempFile::keep() { assert(!Done); Done = true; -#ifdef LLVM_ON_WIN32 +#ifdef _WIN32 if (std::error_code EC = cancelDeleteOnClose(FD)) return errorCodeToError(EC); #else @@ -1177,7 +1177,7 @@ Expected<TempFile> TempFile::create(const Twine &Model, unsigned Mode) { 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()); diff --git a/llvm/lib/Support/Process.cpp b/llvm/lib/Support/Process.cpp index 1c8cc6e83ad..d5f9bdec0e4 100644 --- a/llvm/lib/Support/Process.cpp +++ b/llvm/lib/Support/Process.cpp @@ -93,6 +93,6 @@ bool Process::AreCoreFilesPrevented() { #ifdef LLVM_ON_UNIX #include "Unix/Process.inc" #endif -#ifdef LLVM_ON_WIN32 +#ifdef _WIN32 #include "Windows/Process.inc" #endif diff --git a/llvm/lib/Support/Program.cpp b/llvm/lib/Support/Program.cpp index 4212323bc0e..1a4013d6a4b 100644 --- a/llvm/lib/Support/Program.cpp +++ b/llvm/lib/Support/Program.cpp @@ -67,6 +67,6 @@ ProcessInfo sys::ExecuteNoWait(StringRef Program, const char **Args, #ifdef LLVM_ON_UNIX #include "Unix/Program.inc" #endif -#ifdef LLVM_ON_WIN32 +#ifdef _WIN32 #include "Windows/Program.inc" #endif diff --git a/llvm/lib/Support/RWMutex.cpp b/llvm/lib/Support/RWMutex.cpp index 8182319541e..8b6d74e49f3 100644 --- a/llvm/lib/Support/RWMutex.cpp +++ b/llvm/lib/Support/RWMutex.cpp @@ -117,9 +117,9 @@ RWMutexImpl::writer_release() #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 diff --git a/llvm/lib/Support/RandomNumberGenerator.cpp b/llvm/lib/Support/RandomNumberGenerator.cpp index 47d20159200..6f1e559aaa0 100644 --- a/llvm/lib/Support/RandomNumberGenerator.cpp +++ b/llvm/lib/Support/RandomNumberGenerator.cpp @@ -17,7 +17,7 @@ #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" @@ -63,7 +63,7 @@ RandomNumberGenerator::result_type RandomNumberGenerator::operator()() { // 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)) { diff --git a/llvm/lib/Support/Signals.cpp b/llvm/lib/Support/Signals.cpp index 661f4d649cd..bcd350fbf05 100644 --- a/llvm/lib/Support/Signals.cpp +++ b/llvm/lib/Support/Signals.cpp @@ -125,7 +125,7 @@ static bool printSymbolizedStackTrace(StringRef Argv0, 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. @@ -180,6 +180,6 @@ static bool printSymbolizedStackTrace(StringRef Argv0, #ifdef LLVM_ON_UNIX #include "Unix/Signals.inc" #endif -#ifdef LLVM_ON_WIN32 +#ifdef _WIN32 #include "Windows/Signals.inc" #endif diff --git a/llvm/lib/Support/ThreadLocal.cpp b/llvm/lib/Support/ThreadLocal.cpp index 9a75c02b351..bc349d671fd 100644 --- a/llvm/lib/Support/ThreadLocal.cpp +++ b/llvm/lib/Support/ThreadLocal.cpp @@ -41,8 +41,8 @@ void ThreadLocalImpl::removeInstance() { } #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 diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp index 473c84808af..fcb1030e1ab 100644 --- a/llvm/lib/Support/Threading.cpp +++ b/llvm/lib/Support/Threading.cpp @@ -37,7 +37,7 @@ bool llvm::llvm_is_multithreaded() { } #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) { @@ -89,7 +89,7 @@ unsigned llvm::hardware_concurrency() { #ifdef LLVM_ON_UNIX #include "Unix/Threading.inc" #endif -#ifdef LLVM_ON_WIN32 +#ifdef _WIN32 #include "Windows/Threading.inc" #endif diff --git a/llvm/lib/Support/Unix/Threading.inc b/llvm/lib/Support/Unix/Threading.inc index 31cae474803..9502c00dd62 100644 --- a/llvm/lib/Support/Unix/Threading.inc +++ b/llvm/lib/Support/Unix/Threading.inc @@ -98,7 +98,7 @@ uint64_t llvm::get_threadid() { 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()); diff --git a/llvm/lib/Support/Watchdog.cpp b/llvm/lib/Support/Watchdog.cpp index 724aa001f16..5facd409fda 100644 --- a/llvm/lib/Support/Watchdog.cpp +++ b/llvm/lib/Support/Watchdog.cpp @@ -18,6 +18,6 @@ #ifdef LLVM_ON_UNIX #include "Unix/Watchdog.inc" #endif -#ifdef LLVM_ON_WIN32 +#ifdef _WIN32 #include "Windows/Watchdog.inc" #endif diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp index c0e210bcd5e..68f2f7ac714 100644 --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/lib/Support/raw_ostream.cpp @@ -59,7 +59,7 @@ #endif #endif -#ifdef LLVM_ON_WIN32 +#ifdef _WIN32 #include "Windows/WindowsSupport.h" #endif @@ -533,7 +533,7 @@ raw_fd_ostream::raw_fd_ostream(int fd, bool shouldClose, bool unbuffered) // 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); @@ -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). // 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). @@ -639,7 +639,7 @@ void raw_fd_ostream::close() { 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); |