summaryrefslogtreecommitdiff
path: root/unittests/Support
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2018-04-29 00:45:03 +0000
committerNico Weber <nicolasweber@gmx.de>2018-04-29 00:45:03 +0000
commit63033d33c831112a8aa4f799e797d324466ef674 (patch)
treef0da6edc5ad62458e9fa7354170ef110a9fa5331 /unittests/Support
parente2e5efbda0be1d887f0b215b8b2d261c7921a4e5 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331127 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Support')
-rw-r--r--unittests/Support/CrashRecoveryTest.cpp4
-rw-r--r--unittests/Support/Path.cpp18
-rw-r--r--unittests/Support/ProcessTest.cpp4
-rw-r--r--unittests/Support/ProgramTest.cpp14
-rw-r--r--unittests/Support/TimerTest.cpp4
5 files changed, 22 insertions, 22 deletions
diff --git a/unittests/Support/CrashRecoveryTest.cpp b/unittests/Support/CrashRecoveryTest.cpp
index 3f13693632d..ac531b246c6 100644
--- a/unittests/Support/CrashRecoveryTest.cpp
+++ b/unittests/Support/CrashRecoveryTest.cpp
@@ -11,7 +11,7 @@
#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>
@@ -61,7 +61,7 @@ TEST(CrashRecoveryTest, Cleanup) {
EXPECT_EQ(1, GlobalInt);
}
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
static void raiseIt() {
RaiseException(123, EXCEPTION_NONCONTINUABLE, 0, NULL);
}
diff --git a/unittests/Support/Path.cpp b/unittests/Support/Path.cpp
index 772367f4db3..61cc57fc71a 100644
--- a/unittests/Support/Path.cpp
+++ b/unittests/Support/Path.cpp
@@ -23,7 +23,7 @@
#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>
@@ -59,7 +59,7 @@ TEST(is_separator, Works) {
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('\\'));
@@ -259,7 +259,7 @@ TEST(Support, AbsolutePathIteratorEnd) {
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),
@@ -348,7 +348,7 @@ TEST(Support, TempDirectory) {
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) {
@@ -617,7 +617,7 @@ TEST_F(FileSystemTest, TempFiles) {
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"
@@ -665,7 +665,7 @@ TEST_F(FileSystemTest, CreateDir) {
::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.)
@@ -958,7 +958,7 @@ TEST_F(FileSystemTest, Remove) {
ASSERT_FALSE(fs::exists(BaseDir));
}
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
TEST_F(FileSystemTest, CarriageReturn) {
SmallString<128> FilePathname(TestDirectory);
std::error_code EC;
@@ -1076,7 +1076,7 @@ TEST(Support, NormalizePath) {
EXPECT_EQ(std::get<2>(T), Posix);
}
-#if defined(LLVM_ON_WIN32)
+#if defined(_WIN32)
SmallString<64> 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_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));
diff --git a/unittests/Support/ProcessTest.cpp b/unittests/Support/ProcessTest.cpp
index 37587bf4799..c6ba35fd941 100644
--- a/unittests/Support/ProcessTest.cpp
+++ b/unittests/Support/ProcessTest.cpp
@@ -10,7 +10,7 @@
#include "llvm/Support/Process.h"
#include "gtest/gtest.h"
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
#include <windows.h>
#endif
@@ -45,7 +45,7 @@ TEST(ProcessTest, None) {
}
#endif
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
TEST(ProcessTest, EmptyVal) {
SetEnvironmentVariableA("__LLVM_TEST_ENVIRON_VAR__", "");
diff --git a/unittests/Support/ProgramTest.cpp b/unittests/Support/ProgramTest.cpp
index 3c272bb980c..c11f5fa357d 100644
--- a/unittests/Support/ProgramTest.cpp
+++ b/unittests/Support/ProgramTest.cpp
@@ -26,7 +26,7 @@ extern char **environ;
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);
@@ -65,7 +65,7 @@ class ProgramEnvTest : public testing::Test {
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__)
@@ -77,7 +77,7 @@ protected:
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),
@@ -115,7 +115,7 @@ protected:
}
};
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
TEST_F(ProgramEnvTest, CreateProcessLongPath) {
if (getenv("LLVM_PROGRAM_TEST_LONG_PATH"))
exit(0);
@@ -186,7 +186,7 @@ TEST_F(ProgramEnvTest, CreateProcessTrailingSlash) {
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");
@@ -312,7 +312,7 @@ TEST(ProgramTest, TestExecuteNegative) {
}
-#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[] =
@@ -332,7 +332,7 @@ TEST(ProgramTest, TestWriteWithSystemEncoding) {
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
diff --git a/unittests/Support/TimerTest.cpp b/unittests/Support/TimerTest.cpp
index 082a7e35db5..a92ecf1ac51 100644
--- a/unittests/Support/TimerTest.cpp
+++ b/unittests/Support/TimerTest.cpp
@@ -10,7 +10,7 @@
#include "llvm/Support/Timer.h"
#include "gtest/gtest.h"
-#if LLVM_ON_WIN32
+#if _WIN32
#include <windows.h>
#else
#include <time.h>
@@ -22,7 +22,7 @@ namespace {
// 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;