r331069 - s/LLVM_ON_WIN32/_WIN32/, clang
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 27 12:11:14 PDT 2018
Author: nico
Date: Fri Apr 27 12:11:14 2018
New Revision: 331069
URL: http://llvm.org/viewvc/llvm-project?rev=331069&view=rev
Log:
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.
Modified:
cfe/trunk/examples/clang-interpreter/Manager.h
cfe/trunk/lib/Basic/FileManager.cpp
cfe/trunk/lib/Basic/VirtualFileSystem.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
cfe/trunk/lib/Driver/ToolChains/PS4CPU.cpp
cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/tools/driver/driver.cpp
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/CIndexer.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersInternalTest.cpp
cfe/trunk/unittests/Basic/FileManagerTest.cpp
cfe/trunk/unittests/Driver/ToolChainTest.cpp
cfe/trunk/unittests/Tooling/RefactoringTest.cpp
cfe/trunk/unittests/Tooling/ToolingTest.cpp
Modified: cfe/trunk/examples/clang-interpreter/Manager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/clang-interpreter/Manager.h?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/examples/clang-interpreter/Manager.h (original)
+++ cfe/trunk/examples/clang-interpreter/Manager.h Fri Apr 27 12:11:14 2018
@@ -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
Modified: cfe/trunk/lib/Basic/FileManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/FileManager.cpp (original)
+++ cfe/trunk/lib/Basic/FileManager.cpp Fri Apr 27 12:11:14 2018
@@ -157,7 +157,7 @@ const DirectoryEntry *FileManager::getDi
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;
Modified: cfe/trunk/lib/Basic/VirtualFileSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/VirtualFileSystem.cpp (original)
+++ cfe/trunk/lib/Basic/VirtualFileSystem.cpp Fri Apr 27 12:11:14 2018
@@ -967,7 +967,7 @@ class RedirectingFileSystem : public vfs
/// "." 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::
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");
Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Apr 27 12:11:14 2018
@@ -166,7 +166,7 @@ static const DriverSuffix *FindDriverSuf
/// 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
Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp Fri Apr 27 12:11:14 2018
@@ -378,7 +378,7 @@ void tools::AddGoldPlugin(const ToolChai
// forward.
CmdArgs.push_back("-plugin");
-#if defined(LLVM_ON_WIN32)
+#if defined(_WIN32)
const char *Suffix = ".dll";
#elif defined(__APPLE__)
const char *Suffix = ".dylib";
Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Fri Apr 27 12:11:14 2018
@@ -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::AddClangSystemInclud
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[] = {
Modified: cfe/trunk/lib/Driver/ToolChains/PS4CPU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/PS4CPU.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/PS4CPU.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/PS4CPU.cpp Fri Apr 27 12:11:14 2018
@@ -303,7 +303,7 @@ static void ConstructGoldLinkJob(const T
}
const char *Exec =
-#ifdef LLVM_ON_WIN32
+#ifdef _WIN32
Args.MakeArgString(ToolChain.GetProgramPath("orbis-ld.gold"));
#else
Args.MakeArgString(ToolChain.GetProgramPath("orbis-ld"));
Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
+++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Fri Apr 27 12:11:14 2018
@@ -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);
Modified: cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp (original)
+++ cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp Fri Apr 27 12:11:14 2018
@@ -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"
Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Fri Apr 27 12:11:14 2018
@@ -1806,7 +1806,7 @@ void Preprocessor::HandleIncludeDirectiv
SmallString<128> NormalizedPath;
if (LangOpts.MSVCCompat) {
NormalizedPath = Filename.str();
-#ifndef LLVM_ON_WIN32
+#ifndef _WIN32
llvm::sys::path::native(NormalizedPath);
#endif
}
Modified: cfe/trunk/tools/driver/driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Fri Apr 27 12:11:14 2018
@@ -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.
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Fri Apr 27 12:11:14 2018
@@ -8472,7 +8472,7 @@ void cxindex::printDiagsToStderr(ASTUnit
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.
Modified: cfe/trunk/tools/libclang/CIndexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexer.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndexer.cpp (original)
+++ cfe/trunk/tools/libclang/CIndexer.cpp Fri Apr 27 12:11:14 2018
@@ -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::getClangRes
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,
Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersInternalTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersInternalTest.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersInternalTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersInternalTest.cpp Fri Apr 27 12:11:14 2018
@@ -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
Modified: cfe/trunk/unittests/Basic/FileManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/FileManagerTest.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/unittests/Basic/FileManagerTest.cpp (original)
+++ cfe/trunk/unittests/Basic/FileManagerTest.cpp Fri Apr 27 12:11:14 2018
@@ -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, getFileReturnsVa
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, getFileReturnsVa
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, getFileReturnsNU
// 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, getVirtualFileWi
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 = "/";
Modified: cfe/trunk/unittests/Driver/ToolChainTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Driver/ToolChainTest.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/unittests/Driver/ToolChainTest.cpp (original)
+++ cfe/trunk/unittests/Driver/ToolChainTest.cpp Fri Apr 27 12:11:14 2018
@@ -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, VFSGCCInstallationRe
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: "
Modified: cfe/trunk/unittests/Tooling/RefactoringTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/RefactoringTest.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/RefactoringTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/RefactoringTest.cpp Fri Apr 27 12:11:14 2018
@@ -1035,7 +1035,7 @@ TEST(DeduplicateByFileTest, PathsWithDot
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, PathWithDotS
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, NonExistingF
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
Modified: cfe/trunk/unittests/Tooling/ToolingTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/ToolingTest.cpp?rev=331069&r1=331068&r2=331069&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/ToolingTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/ToolingTest.cpp Fri Apr 27 12:11:14 2018
@@ -216,7 +216,7 @@ struct VerifyEndCallback : public Source
bool Matched;
};
-#if !defined(LLVM_ON_WIN32)
+#if !defined(_WIN32)
TEST(newFrontendActionFactory, InjectsSourceFileCallbacks) {
VerifyEndCallback EndCallback;
@@ -531,7 +531,7 @@ TEST(addTargetAndModeForProgramName, Ign
ArgsAlt);
}
-#ifndef LLVM_ON_WIN32
+#ifndef _WIN32
TEST(ClangToolTest, BuildASTs) {
FixedCompilationDatabase Compilations("/", std::vector<std::string>());
More information about the cfe-commits
mailing list