s/LLVM_ON_WIN32/_WIN32/, clang

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.

llvm-svn: 331069
This commit is contained in:
Nico Weber 2018-04-27 19:11:14 +00:00
parent ee5be798da
commit 1865df4996
18 changed files with 34 additions and 34 deletions

View file

@ -12,7 +12,7 @@
#include "llvm/ExecutionEngine/SectionMemoryManager.h"
#if defined(LLVM_ON_WIN32) && defined(_WIN64)
#if defined(_WIN32) && defined(_WIN64)
#define CLANG_INTERPRETER_COFF_FORMAT
#define CLANG_INTERPRETER_WIN_EXCEPTIONS
#endif

View file

@ -157,7 +157,7 @@ const DirectoryEntry *FileManager::getDirectory(StringRef DirName,
DirName != llvm::sys::path::root_path(DirName) &&
llvm::sys::path::is_separator(DirName.back()))
DirName = DirName.substr(0, DirName.size()-1);
#ifdef LLVM_ON_WIN32
#ifdef _WIN32
// Fixing a problem with "clang C:test.c" on Windows.
// Stat("C:") does not recognize "C:" as a valid directory
std::string DirNameStr;

View file

@ -967,7 +967,7 @@ class RedirectingFileSystem : public vfs::FileSystem {
/// "." and "./" in their paths. FIXME: some unittests currently fail on
/// win32 when using remove_dots and remove_leading_dotslash on paths.
bool UseCanonicalizedPaths =
#ifdef LLVM_ON_WIN32
#ifdef _WIN32
false;
#else
true;
@ -1560,7 +1560,7 @@ ErrorOr<Entry *> RedirectingFileSystem::lookupPath(const Twine &Path_) {
ErrorOr<Entry *>
RedirectingFileSystem::lookupPath(sys::path::const_iterator Start,
sys::path::const_iterator End, Entry *From) {
#ifndef LLVM_ON_WIN32
#ifndef _WIN32
assert(!isTraversalComponent(*Start) &&
!isTraversalComponent(From->getName()) &&
"Paths should not contain traversal components");

View file

@ -166,7 +166,7 @@ static const DriverSuffix *FindDriverSuffix(StringRef ProgName, size_t &Pos) {
/// present and lower-casing the string on Windows.
static std::string normalizeProgramName(llvm::StringRef Argv0) {
std::string ProgName = llvm::sys::path::stem(Argv0);
#ifdef LLVM_ON_WIN32
#ifdef _WIN32
// Transform to lowercase for case insensitive file systems.
std::transform(ProgName.begin(), ProgName.end(), ProgName.begin(), ::tolower);
#endif

View file

@ -378,7 +378,7 @@ void tools::AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args,
// forward.
CmdArgs.push_back("-plugin");
#if defined(LLVM_ON_WIN32)
#if defined(_WIN32)
const char *Suffix = ".dll";
#elif defined(__APPLE__)
const char *Suffix = ".dylib";

View file

@ -33,7 +33,7 @@
// Include the necessary headers to interface with the Windows registry and
// environment.
#if defined(LLVM_ON_WIN32)
#if defined(_WIN32)
#define USE_WIN32
#endif
@ -1242,7 +1242,7 @@ void MSVCToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
return;
}
#if defined(LLVM_ON_WIN32)
#if defined(_WIN32)
// As a fallback, select default install paths.
// FIXME: Don't guess drives and paths like this on Windows.
const StringRef Paths[] = {

View file

@ -303,7 +303,7 @@ static void ConstructGoldLinkJob(const Tool &T, Compilation &C,
}
const char *Exec =
#ifdef LLVM_ON_WIN32
#ifdef _WIN32
Args.MakeArgString(ToolChain.GetProgramPath("orbis-ld.gold"));
#else
Args.MakeArgString(ToolChain.GetProgramPath("orbis-ld"));

View file

@ -105,7 +105,7 @@ public:
} // end anonymous namespace.
static bool CanPrefixSysroot(StringRef Path) {
#if defined(LLVM_ON_WIN32)
#if defined(_WIN32)
return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
#else
return llvm::sys::path::is_absolute(Path);

View file

@ -40,7 +40,7 @@ namespace {
StringRef getInMemoryPreamblePath() {
#if defined(LLVM_ON_UNIX)
return "/__clang_tmp/___clang_inmemory_preamble___";
#elif defined(LLVM_ON_WIN32)
#elif defined(_WIN32)
return "C:\\__clang_tmp\\___clang_inmemory_preamble___";
#else
#warning "Unknown platform. Defaulting to UNIX-style paths for in-memory PCHs"

View file

@ -1806,7 +1806,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,
SmallString<128> NormalizedPath;
if (LangOpts.MSVCCompat) {
NormalizedPath = Filename.str();
#ifndef LLVM_ON_WIN32
#ifndef _WIN32
llvm::sys::path::native(NormalizedPath);
#endif
}

View file

@ -485,7 +485,7 @@ int main(int argc_, const char **argv_) {
// On Windows, abort will return an exit code of 3. In these cases,
// generate additional diagnostic information if possible.
bool DiagnoseCrash = CommandRes < 0 || CommandRes == 70;
#ifdef LLVM_ON_WIN32
#ifdef _WIN32
DiagnoseCrash |= CommandRes == 3;
#endif
if (DiagnoseCrash) {
@ -501,7 +501,7 @@ int main(int argc_, const char **argv_) {
// results now. This happens in -disable-free mode.
llvm::TimerGroup::printAll(llvm::errs());
#ifdef LLVM_ON_WIN32
#ifdef _WIN32
// Exit status should not be negative on Win32, unless abnormal termination.
// Once abnormal termiation was caught, negative status should not be
// propagated.

View file

@ -8472,7 +8472,7 @@ void cxindex::printDiagsToStderr(ASTUnit *Unit) {
fprintf(stderr, "%s\n", clang_getCString(Msg));
clang_disposeString(Msg);
}
#ifdef LLVM_ON_WIN32
#ifdef _WIN32
// On Windows, force a flush, since there may be multiple copies of
// stderr and stdout in the file system, all with different buffers
// but writing to the same device.

View file

@ -28,10 +28,10 @@
#ifdef __CYGWIN__
#include <cygwin/version.h>
#include <sys/cygwin.h>
#define LLVM_ON_WIN32 1
#define _WIN32 1
#endif
#ifdef LLVM_ON_WIN32
#ifdef _WIN32
#include <windows.h>
#else
#include <dlfcn.h>
@ -47,7 +47,7 @@ const std::string &CIndexer::getClangResourcesPath() {
SmallString<128> LibClangPath;
// Find the location where this library lives (libclang.dylib).
#ifdef LLVM_ON_WIN32
#ifdef _WIN32
MEMORY_BASIC_INFORMATION mbi;
char path[MAX_PATH];
VirtualQuery((void *)(uintptr_t)clang_createTranslationUnit, &mbi,

View file

@ -189,7 +189,7 @@ TEST(IsInlineMatcher, IsInline) {
// FIXME: Figure out how to specify paths so the following tests pass on
// Windows.
#ifndef LLVM_ON_WIN32
#ifndef _WIN32
TEST(Matcher, IsExpansionInMainFileMatcher) {
EXPECT_TRUE(matches("class X {};",
@ -234,7 +234,7 @@ TEST(Matcher, IsExpansionInFileMatching) {
"-isystem/", M));
}
#endif // LLVM_ON_WIN32
#endif // _WIN32
} // end namespace ast_matchers
} // end namespace clang

View file

@ -31,7 +31,7 @@ private:
llvm::StringMap<FileData, llvm::BumpPtrAllocator> StatCalls;
void InjectFileOrDirectory(const char *Path, ino_t INode, bool IsFile) {
#ifndef LLVM_ON_WIN32
#ifndef _WIN32
SmallString<128> NormalizedPath(Path);
llvm::sys::path::native(NormalizedPath);
Path = NormalizedPath.c_str();
@ -63,7 +63,7 @@ public:
LookupResult getStat(StringRef Path, FileData &Data, bool isFile,
std::unique_ptr<vfs::File> *F,
vfs::FileSystem &FS) override {
#ifndef LLVM_ON_WIN32
#ifndef _WIN32
SmallString<128> NormalizedPath(Path);
llvm::sys::path::native(NormalizedPath);
Path = NormalizedPath.c_str();
@ -143,7 +143,7 @@ TEST_F(FileManagerTest, getFileReturnsValidFileEntryForExistingRealFile) {
statCache->InjectDirectory("/tmp", 42);
statCache->InjectFile("/tmp/test", 43);
#ifdef LLVM_ON_WIN32
#ifdef _WIN32
const char *DirName = "C:.";
const char *FileName = "C:test";
statCache->InjectDirectory(DirName, 44);
@ -161,7 +161,7 @@ TEST_F(FileManagerTest, getFileReturnsValidFileEntryForExistingRealFile) {
ASSERT_TRUE(dir != nullptr);
EXPECT_EQ("/tmp", dir->getName());
#ifdef LLVM_ON_WIN32
#ifdef _WIN32
file = manager.getFile(FileName);
ASSERT_TRUE(file != NULL);
@ -225,7 +225,7 @@ TEST_F(FileManagerTest, getFileReturnsNULLForNonexistentFile) {
// The following tests apply to Unix-like system only.
#ifndef LLVM_ON_WIN32
#ifndef _WIN32
// getFile() returns the same FileEntry for real files that are aliases.
TEST_F(FileManagerTest, getFileReturnsSameFileEntryForAliasedRealFiles) {
@ -295,11 +295,11 @@ TEST_F(FileManagerTest, getVirtualFileWithDifferentName) {
EXPECT_EQ(123, file2->getSize());
}
#endif // !LLVM_ON_WIN32
#endif // !_WIN32
TEST_F(FileManagerTest, makeAbsoluteUsesVFS) {
SmallString<64> CustomWorkingDir;
#ifdef LLVM_ON_WIN32
#ifdef _WIN32
CustomWorkingDir = "C:";
#else
CustomWorkingDir = "/";

View file

@ -69,7 +69,7 @@ TEST(ToolChainTest, VFSGCCInstallation) {
llvm::raw_string_ostream OS(S);
C->getDefaultToolChain().printVerboseInfo(OS);
}
#if LLVM_ON_WIN32
#if _WIN32
std::replace(S.begin(), S.end(), '\\', '/');
#endif
EXPECT_EQ(
@ -109,7 +109,7 @@ TEST(ToolChainTest, VFSGCCInstallationRelativeDir) {
llvm::raw_string_ostream OS(S);
C->getDefaultToolChain().printVerboseInfo(OS);
}
#if LLVM_ON_WIN32
#if _WIN32
std::replace(S.begin(), S.end(), '\\', '/');
#endif
EXPECT_EQ("Found candidate GCC installation: "

View file

@ -1035,7 +1035,7 @@ TEST(DeduplicateByFileTest, PathsWithDots) {
llvm::IntrusiveRefCntPtr<vfs::InMemoryFileSystem> VFS(
new vfs::InMemoryFileSystem());
FileManager FileMgr(FileSystemOptions(), VFS);
#if !defined(LLVM_ON_WIN32)
#if !defined(_WIN32)
StringRef Path1 = "a/b/.././c.h";
StringRef Path2 = "a/c.h";
#else
@ -1056,7 +1056,7 @@ TEST(DeduplicateByFileTest, PathWithDotSlash) {
llvm::IntrusiveRefCntPtr<vfs::InMemoryFileSystem> VFS(
new vfs::InMemoryFileSystem());
FileManager FileMgr(FileSystemOptions(), VFS);
#if !defined(LLVM_ON_WIN32)
#if !defined(_WIN32)
StringRef Path1 = "./a/b/c.h";
StringRef Path2 = "a/b/c.h";
#else
@ -1077,7 +1077,7 @@ TEST(DeduplicateByFileTest, NonExistingFilePath) {
llvm::IntrusiveRefCntPtr<vfs::InMemoryFileSystem> VFS(
new vfs::InMemoryFileSystem());
FileManager FileMgr(FileSystemOptions(), VFS);
#if !defined(LLVM_ON_WIN32)
#if !defined(_WIN32)
StringRef Path1 = "./a/b/c.h";
StringRef Path2 = "a/b/c.h";
#else

View file

@ -216,7 +216,7 @@ struct VerifyEndCallback : public SourceFileCallbacks {
bool Matched;
};
#if !defined(LLVM_ON_WIN32)
#if !defined(_WIN32)
TEST(newFrontendActionFactory, InjectsSourceFileCallbacks) {
VerifyEndCallback EndCallback;
@ -531,7 +531,7 @@ TEST(addTargetAndModeForProgramName, IgnoresExistingMode) {
ArgsAlt);
}
#ifndef LLVM_ON_WIN32
#ifndef _WIN32
TEST(ClangToolTest, BuildASTs) {
FixedCompilationDatabase Compilations("/", std::vector<std::string>());