diff options
author | Nico Weber <nicolasweber@gmx.de> | 2018-04-27 19:11:14 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2018-04-27 19:11:14 +0000 |
commit | 1865df49960e34cc90d0083b0e0cd4771c0feb35 (patch) | |
tree | e6c91dba6b86e3fc8970a42e8291771e32f82239 /clang | |
parent | ee5be798dae30d5f9414b01f76ff807edbc881aa (diff) | |
download | llvm-1865df49960e34cc90d0083b0e0cd4771c0feb35.zip llvm-1865df49960e34cc90d0083b0e0cd4771c0feb35.tar.gz llvm-1865df49960e34cc90d0083b0e0cd4771c0feb35.tar.bz2 |
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
Diffstat (limited to 'clang')
-rw-r--r-- | clang/examples/clang-interpreter/Manager.h | 2 | ||||
-rw-r--r-- | clang/lib/Basic/FileManager.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Basic/VirtualFileSystem.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Driver/ToolChain.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Driver/ToolChains/CommonArgs.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Driver/ToolChains/MSVC.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Driver/ToolChains/PS4CPU.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Frontend/InitHeaderSearch.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Frontend/PrecompiledPreamble.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 2 | ||||
-rw-r--r-- | clang/tools/driver/driver.cpp | 4 | ||||
-rw-r--r-- | clang/tools/libclang/CIndex.cpp | 2 | ||||
-rw-r--r-- | clang/tools/libclang/CIndexer.cpp | 6 | ||||
-rw-r--r-- | clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp | 4 | ||||
-rw-r--r-- | clang/unittests/Basic/FileManagerTest.cpp | 14 | ||||
-rw-r--r-- | clang/unittests/Driver/ToolChainTest.cpp | 4 | ||||
-rw-r--r-- | clang/unittests/Tooling/RefactoringTest.cpp | 6 | ||||
-rw-r--r-- | clang/unittests/Tooling/ToolingTest.cpp | 4 |
18 files changed, 34 insertions, 34 deletions
diff --git a/clang/examples/clang-interpreter/Manager.h b/clang/examples/clang-interpreter/Manager.h index d1b1461..013bbbc 100644 --- a/clang/examples/clang-interpreter/Manager.h +++ b/clang/examples/clang-interpreter/Manager.h @@ -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 diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp index 45c4bf0..6fc00d9 100644 --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -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; diff --git a/clang/lib/Basic/VirtualFileSystem.cpp b/clang/lib/Basic/VirtualFileSystem.cpp index 413d439..3a0f041 100644 --- a/clang/lib/Basic/VirtualFileSystem.cpp +++ b/clang/lib/Basic/VirtualFileSystem.cpp @@ -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"); diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index bf97557..e3ea1bf 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -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 diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index c2583dd..be09bc1 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -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"; diff --git a/clang/lib/Driver/ToolChains/MSVC.cpp b/clang/lib/Driver/ToolChains/MSVC.cpp index 8458c03..eed6afd 100644 --- a/clang/lib/Driver/ToolChains/MSVC.cpp +++ b/clang/lib/Driver/ToolChains/MSVC.cpp @@ -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[] = { diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp b/clang/lib/Driver/ToolChains/PS4CPU.cpp index b37fe7d..16d9bc8 100644 --- a/clang/lib/Driver/ToolChains/PS4CPU.cpp +++ b/clang/lib/Driver/ToolChains/PS4CPU.cpp @@ -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")); diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp index 0506975..d2fcc9a 100644 --- a/clang/lib/Frontend/InitHeaderSearch.cpp +++ b/clang/lib/Frontend/InitHeaderSearch.cpp @@ -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); diff --git a/clang/lib/Frontend/PrecompiledPreamble.cpp b/clang/lib/Frontend/PrecompiledPreamble.cpp index ddd7bda..23371d1 100644 --- a/clang/lib/Frontend/PrecompiledPreamble.cpp +++ b/clang/lib/Frontend/PrecompiledPreamble.cpp @@ -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" diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 6cc84c7..e1a0438 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -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 } diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp index 1913996..c83e103 100644 --- a/clang/tools/driver/driver.cpp +++ b/clang/tools/driver/driver.cpp @@ -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. diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 497a3ca..3807231 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -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. diff --git a/clang/tools/libclang/CIndexer.cpp b/clang/tools/libclang/CIndexer.cpp index 30054ea..4c63e14 100644 --- a/clang/tools/libclang/CIndexer.cpp +++ b/clang/tools/libclang/CIndexer.cpp @@ -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, diff --git a/clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp index c12056f4..288fce0 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp @@ -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 diff --git a/clang/unittests/Basic/FileManagerTest.cpp b/clang/unittests/Basic/FileManagerTest.cpp index a2a6c6a..5b7a7db 100644 --- a/clang/unittests/Basic/FileManagerTest.cpp +++ b/clang/unittests/Basic/FileManagerTest.cpp @@ -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 = "/"; diff --git a/clang/unittests/Driver/ToolChainTest.cpp b/clang/unittests/Driver/ToolChainTest.cpp index 93cf12b..d4198ea 100644 --- a/clang/unittests/Driver/ToolChainTest.cpp +++ b/clang/unittests/Driver/ToolChainTest.cpp @@ -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: " diff --git a/clang/unittests/Tooling/RefactoringTest.cpp b/clang/unittests/Tooling/RefactoringTest.cpp index 41836f1..fcd2aa5 100644 --- a/clang/unittests/Tooling/RefactoringTest.cpp +++ b/clang/unittests/Tooling/RefactoringTest.cpp @@ -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 diff --git a/clang/unittests/Tooling/ToolingTest.cpp b/clang/unittests/Tooling/ToolingTest.cpp index bd57118..057c6b3 100644 --- a/clang/unittests/Tooling/ToolingTest.cpp +++ b/clang/unittests/Tooling/ToolingTest.cpp @@ -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>()); |