]> granicus.if.org Git - clang/commitdiff
s/LLVM_ON_WIN32/_WIN32/, clang
authorNico Weber <nicolasweber@gmx.de>
Fri, 27 Apr 2018 19:11:14 +0000 (19:11 +0000)
committerNico Weber <nicolasweber@gmx.de>
Fri, 27 Apr 2018 19:11:14 +0000 (19:11 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331069 91177308-0d34-0410-b5e6-96231b3b80d8

18 files changed:
examples/clang-interpreter/Manager.h
lib/Basic/FileManager.cpp
lib/Basic/VirtualFileSystem.cpp
lib/Driver/ToolChain.cpp
lib/Driver/ToolChains/CommonArgs.cpp
lib/Driver/ToolChains/MSVC.cpp
lib/Driver/ToolChains/PS4CPU.cpp
lib/Frontend/InitHeaderSearch.cpp
lib/Frontend/PrecompiledPreamble.cpp
lib/Lex/PPDirectives.cpp
tools/driver/driver.cpp
tools/libclang/CIndex.cpp
tools/libclang/CIndexer.cpp
unittests/ASTMatchers/ASTMatchersInternalTest.cpp
unittests/Basic/FileManagerTest.cpp
unittests/Driver/ToolChainTest.cpp
unittests/Tooling/RefactoringTest.cpp
unittests/Tooling/ToolingTest.cpp

index d1b146151dede40450379d1cc1e837407eee8af7..013bbbccfd70764daa967bbd2f27bdddfd423b81 100644 (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
index 45c4bf0b3155aa439667fffa8aafe5f90ba033ae..6fc00d9f41307ef7bfd4fb8e81cf46200b241505 100644 (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;
index 413d43994a3e41231331776e201ed9bc4e8c1fc7..3a0f041047aeee4cc21d719d4add7e59d00e2c4b 100644 (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");
index bf97557bd6feb1eef24b57c0120c470cfcf6e21c..e3ea1bff2ffc6db13f8a03eaad5ed163b9877387 100644 (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
index c2583dd6fbfe71579c0ffc6e192390aa42fb10d9..be09bc19fda2912caaa16b90666bdd3a9e34b88c 100644 (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";
index 8458c0396ee3a45b191914ae55895624e1057be7..eed6afdfa53b9247063d6d76284332a57044a8c7 100644 (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[] = {
index b37fe7d1f9b910d4790b987b1e22189d1bfb7a52..16d9bc87d8c1e4e40cbe6f0eea2d46a831ba4b80 100644 (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"));
index 0506975b027f619b36927cb79296927e8f59adcb..d2fcc9a994afd79acdce084c234dc366caddbaaf 100644 (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);
index ddd7bda546fe9b695f96716ff9c5d0176c5a38ae..23371d1f4264c9813fdf48ae1bff87f279704965 100644 (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"
index 6cc84c7512e3b4a6fc7fa36457c9cd2702b5d039..e1a0438d1ddd245f7cba2d8b66b1a78022cdd3c4 100644 (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
   }
index 1913996aebb10599e17777f675650eb2bbcb67b6..c83e1036eb7daeebc3402adaefbda46a7d52429e 100644 (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.
index 497a3ca8f5432d0cc9b9be46a2d34dd9e04fa644..380723108cedb335f8056141d0cfecd12edcc625 100644 (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.
index 30054ea9f798d2ebfa9e009ea7d9f06bc5e7c3d1..4c63e14ad5cd9463644351e48447e65f1ba977d2 100644 (file)
 #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,
index c12056f4440a29b1e627ad2dc6a3a4f9db780dbb..288fce08a8d9a9e1fdbb48a7de097a1261668267 100644 (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
index a2a6c6aebe4b04a5f9960991ace46073d199c26b..5b7a7db4400bb660a77e25d2f7c59e8595cb764b 100644 (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 = "/";
index 93cf12b3c2be4c37c5ba2b1e4cc04c1b7e7c3945..d4198eaeb1cb10e3707dafde54d4aca4316affb9 100644 (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: "
index 41836f11ee29d6b25109f653c56eef90c90ed06d..fcd2aa593730c3e202d25c5272e590283c4bbb60 100644 (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
index bd57118e3a9b7c05bf8a7ef38a9f10581dd87921..057c6b33263185acd16f9164361f3294a3c6e66f 100644 (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>());