Skip to content

Commit 1865df4

Browse files
committed
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
1 parent ee5be79 commit 1865df4

18 files changed

+34
-34
lines changed

clang/examples/clang-interpreter/Manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include "llvm/ExecutionEngine/SectionMemoryManager.h"
1414

15-
#if defined(LLVM_ON_WIN32) && defined(_WIN64)
15+
#if defined(_WIN32) && defined(_WIN64)
1616
#define CLANG_INTERPRETER_COFF_FORMAT
1717
#define CLANG_INTERPRETER_WIN_EXCEPTIONS
1818
#endif

clang/lib/Basic/FileManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ const DirectoryEntry *FileManager::getDirectory(StringRef DirName,
157157
DirName != llvm::sys::path::root_path(DirName) &&
158158
llvm::sys::path::is_separator(DirName.back()))
159159
DirName = DirName.substr(0, DirName.size()-1);
160-
#ifdef LLVM_ON_WIN32
160+
#ifdef _WIN32
161161
// Fixing a problem with "clang C:test.c" on Windows.
162162
// Stat("C:") does not recognize "C:" as a valid directory
163163
std::string DirNameStr;

clang/lib/Basic/VirtualFileSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ class RedirectingFileSystem : public vfs::FileSystem {
967967
/// "." and "./" in their paths. FIXME: some unittests currently fail on
968968
/// win32 when using remove_dots and remove_leading_dotslash on paths.
969969
bool UseCanonicalizedPaths =
970-
#ifdef LLVM_ON_WIN32
970+
#ifdef _WIN32
971971
false;
972972
#else
973973
true;
@@ -1560,7 +1560,7 @@ ErrorOr<Entry *> RedirectingFileSystem::lookupPath(const Twine &Path_) {
15601560
ErrorOr<Entry *>
15611561
RedirectingFileSystem::lookupPath(sys::path::const_iterator Start,
15621562
sys::path::const_iterator End, Entry *From) {
1563-
#ifndef LLVM_ON_WIN32
1563+
#ifndef _WIN32
15641564
assert(!isTraversalComponent(*Start) &&
15651565
!isTraversalComponent(From->getName()) &&
15661566
"Paths should not contain traversal components");

clang/lib/Driver/ToolChain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ static const DriverSuffix *FindDriverSuffix(StringRef ProgName, size_t &Pos) {
166166
/// present and lower-casing the string on Windows.
167167
static std::string normalizeProgramName(llvm::StringRef Argv0) {
168168
std::string ProgName = llvm::sys::path::stem(Argv0);
169-
#ifdef LLVM_ON_WIN32
169+
#ifdef _WIN32
170170
// Transform to lowercase for case insensitive file systems.
171171
std::transform(ProgName.begin(), ProgName.end(), ProgName.begin(), ::tolower);
172172
#endif

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ void tools::AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args,
378378
// forward.
379379
CmdArgs.push_back("-plugin");
380380

381-
#if defined(LLVM_ON_WIN32)
381+
#if defined(_WIN32)
382382
const char *Suffix = ".dll";
383383
#elif defined(__APPLE__)
384384
const char *Suffix = ".dylib";

clang/lib/Driver/ToolChains/MSVC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
// Include the necessary headers to interface with the Windows registry and
3535
// environment.
36-
#if defined(LLVM_ON_WIN32)
36+
#if defined(_WIN32)
3737
#define USE_WIN32
3838
#endif
3939

@@ -1242,7 +1242,7 @@ void MSVCToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
12421242
return;
12431243
}
12441244

1245-
#if defined(LLVM_ON_WIN32)
1245+
#if defined(_WIN32)
12461246
// As a fallback, select default install paths.
12471247
// FIXME: Don't guess drives and paths like this on Windows.
12481248
const StringRef Paths[] = {

clang/lib/Driver/ToolChains/PS4CPU.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ static void ConstructGoldLinkJob(const Tool &T, Compilation &C,
303303
}
304304

305305
const char *Exec =
306-
#ifdef LLVM_ON_WIN32
306+
#ifdef _WIN32
307307
Args.MakeArgString(ToolChain.GetProgramPath("orbis-ld.gold"));
308308
#else
309309
Args.MakeArgString(ToolChain.GetProgramPath("orbis-ld"));

clang/lib/Frontend/InitHeaderSearch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class InitHeaderSearch {
105105
} // end anonymous namespace.
106106

107107
static bool CanPrefixSysroot(StringRef Path) {
108-
#if defined(LLVM_ON_WIN32)
108+
#if defined(_WIN32)
109109
return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
110110
#else
111111
return llvm::sys::path::is_absolute(Path);

clang/lib/Frontend/PrecompiledPreamble.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace {
4040
StringRef getInMemoryPreamblePath() {
4141
#if defined(LLVM_ON_UNIX)
4242
return "/__clang_tmp/___clang_inmemory_preamble___";
43-
#elif defined(LLVM_ON_WIN32)
43+
#elif defined(_WIN32)
4444
return "C:\\__clang_tmp\\___clang_inmemory_preamble___";
4545
#else
4646
#warning "Unknown platform. Defaulting to UNIX-style paths for in-memory PCHs"

clang/lib/Lex/PPDirectives.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1806,7 +1806,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,
18061806
SmallString<128> NormalizedPath;
18071807
if (LangOpts.MSVCCompat) {
18081808
NormalizedPath = Filename.str();
1809-
#ifndef LLVM_ON_WIN32
1809+
#ifndef _WIN32
18101810
llvm::sys::path::native(NormalizedPath);
18111811
#endif
18121812
}

clang/tools/driver/driver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ int main(int argc_, const char **argv_) {
485485
// On Windows, abort will return an exit code of 3. In these cases,
486486
// generate additional diagnostic information if possible.
487487
bool DiagnoseCrash = CommandRes < 0 || CommandRes == 70;
488-
#ifdef LLVM_ON_WIN32
488+
#ifdef _WIN32
489489
DiagnoseCrash |= CommandRes == 3;
490490
#endif
491491
if (DiagnoseCrash) {
@@ -501,7 +501,7 @@ int main(int argc_, const char **argv_) {
501501
// results now. This happens in -disable-free mode.
502502
llvm::TimerGroup::printAll(llvm::errs());
503503

504-
#ifdef LLVM_ON_WIN32
504+
#ifdef _WIN32
505505
// Exit status should not be negative on Win32, unless abnormal termination.
506506
// Once abnormal termiation was caught, negative status should not be
507507
// propagated.

clang/tools/libclang/CIndex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8472,7 +8472,7 @@ void cxindex::printDiagsToStderr(ASTUnit *Unit) {
84728472
fprintf(stderr, "%s\n", clang_getCString(Msg));
84738473
clang_disposeString(Msg);
84748474
}
8475-
#ifdef LLVM_ON_WIN32
8475+
#ifdef _WIN32
84768476
// On Windows, force a flush, since there may be multiple copies of
84778477
// stderr and stdout in the file system, all with different buffers
84788478
// but writing to the same device.

clang/tools/libclang/CIndexer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
#ifdef __CYGWIN__
2929
#include <cygwin/version.h>
3030
#include <sys/cygwin.h>
31-
#define LLVM_ON_WIN32 1
31+
#define _WIN32 1
3232
#endif
3333

34-
#ifdef LLVM_ON_WIN32
34+
#ifdef _WIN32
3535
#include <windows.h>
3636
#else
3737
#include <dlfcn.h>
@@ -47,7 +47,7 @@ const std::string &CIndexer::getClangResourcesPath() {
4747
SmallString<128> LibClangPath;
4848

4949
// Find the location where this library lives (libclang.dylib).
50-
#ifdef LLVM_ON_WIN32
50+
#ifdef _WIN32
5151
MEMORY_BASIC_INFORMATION mbi;
5252
char path[MAX_PATH];
5353
VirtualQuery((void *)(uintptr_t)clang_createTranslationUnit, &mbi,

clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ TEST(IsInlineMatcher, IsInline) {
189189

190190
// FIXME: Figure out how to specify paths so the following tests pass on
191191
// Windows.
192-
#ifndef LLVM_ON_WIN32
192+
#ifndef _WIN32
193193

194194
TEST(Matcher, IsExpansionInMainFileMatcher) {
195195
EXPECT_TRUE(matches("class X {};",
@@ -234,7 +234,7 @@ TEST(Matcher, IsExpansionInFileMatching) {
234234
"-isystem/", M));
235235
}
236236

237-
#endif // LLVM_ON_WIN32
237+
#endif // _WIN32
238238

239239
} // end namespace ast_matchers
240240
} // end namespace clang

clang/unittests/Basic/FileManagerTest.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class FakeStatCache : public FileSystemStatCache {
3131
llvm::StringMap<FileData, llvm::BumpPtrAllocator> StatCalls;
3232

3333
void InjectFileOrDirectory(const char *Path, ino_t INode, bool IsFile) {
34-
#ifndef LLVM_ON_WIN32
34+
#ifndef _WIN32
3535
SmallString<128> NormalizedPath(Path);
3636
llvm::sys::path::native(NormalizedPath);
3737
Path = NormalizedPath.c_str();
@@ -63,7 +63,7 @@ class FakeStatCache : public FileSystemStatCache {
6363
LookupResult getStat(StringRef Path, FileData &Data, bool isFile,
6464
std::unique_ptr<vfs::File> *F,
6565
vfs::FileSystem &FS) override {
66-
#ifndef LLVM_ON_WIN32
66+
#ifndef _WIN32
6767
SmallString<128> NormalizedPath(Path);
6868
llvm::sys::path::native(NormalizedPath);
6969
Path = NormalizedPath.c_str();
@@ -143,7 +143,7 @@ TEST_F(FileManagerTest, getFileReturnsValidFileEntryForExistingRealFile) {
143143
statCache->InjectDirectory("/tmp", 42);
144144
statCache->InjectFile("/tmp/test", 43);
145145

146-
#ifdef LLVM_ON_WIN32
146+
#ifdef _WIN32
147147
const char *DirName = "C:.";
148148
const char *FileName = "C:test";
149149
statCache->InjectDirectory(DirName, 44);
@@ -161,7 +161,7 @@ TEST_F(FileManagerTest, getFileReturnsValidFileEntryForExistingRealFile) {
161161
ASSERT_TRUE(dir != nullptr);
162162
EXPECT_EQ("/tmp", dir->getName());
163163

164-
#ifdef LLVM_ON_WIN32
164+
#ifdef _WIN32
165165
file = manager.getFile(FileName);
166166
ASSERT_TRUE(file != NULL);
167167

@@ -225,7 +225,7 @@ TEST_F(FileManagerTest, getFileReturnsNULLForNonexistentFile) {
225225

226226
// The following tests apply to Unix-like system only.
227227

228-
#ifndef LLVM_ON_WIN32
228+
#ifndef _WIN32
229229

230230
// getFile() returns the same FileEntry for real files that are aliases.
231231
TEST_F(FileManagerTest, getFileReturnsSameFileEntryForAliasedRealFiles) {
@@ -295,11 +295,11 @@ TEST_F(FileManagerTest, getVirtualFileWithDifferentName) {
295295
EXPECT_EQ(123, file2->getSize());
296296
}
297297

298-
#endif // !LLVM_ON_WIN32
298+
#endif // !_WIN32
299299

300300
TEST_F(FileManagerTest, makeAbsoluteUsesVFS) {
301301
SmallString<64> CustomWorkingDir;
302-
#ifdef LLVM_ON_WIN32
302+
#ifdef _WIN32
303303
CustomWorkingDir = "C:";
304304
#else
305305
CustomWorkingDir = "/";

clang/unittests/Driver/ToolChainTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ TEST(ToolChainTest, VFSGCCInstallation) {
6969
llvm::raw_string_ostream OS(S);
7070
C->getDefaultToolChain().printVerboseInfo(OS);
7171
}
72-
#if LLVM_ON_WIN32
72+
#if _WIN32
7373
std::replace(S.begin(), S.end(), '\\', '/');
7474
#endif
7575
EXPECT_EQ(
@@ -109,7 +109,7 @@ TEST(ToolChainTest, VFSGCCInstallationRelativeDir) {
109109
llvm::raw_string_ostream OS(S);
110110
C->getDefaultToolChain().printVerboseInfo(OS);
111111
}
112-
#if LLVM_ON_WIN32
112+
#if _WIN32
113113
std::replace(S.begin(), S.end(), '\\', '/');
114114
#endif
115115
EXPECT_EQ("Found candidate GCC installation: "

clang/unittests/Tooling/RefactoringTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ TEST(DeduplicateByFileTest, PathsWithDots) {
10351035
llvm::IntrusiveRefCntPtr<vfs::InMemoryFileSystem> VFS(
10361036
new vfs::InMemoryFileSystem());
10371037
FileManager FileMgr(FileSystemOptions(), VFS);
1038-
#if !defined(LLVM_ON_WIN32)
1038+
#if !defined(_WIN32)
10391039
StringRef Path1 = "a/b/.././c.h";
10401040
StringRef Path2 = "a/c.h";
10411041
#else
@@ -1056,7 +1056,7 @@ TEST(DeduplicateByFileTest, PathWithDotSlash) {
10561056
llvm::IntrusiveRefCntPtr<vfs::InMemoryFileSystem> VFS(
10571057
new vfs::InMemoryFileSystem());
10581058
FileManager FileMgr(FileSystemOptions(), VFS);
1059-
#if !defined(LLVM_ON_WIN32)
1059+
#if !defined(_WIN32)
10601060
StringRef Path1 = "./a/b/c.h";
10611061
StringRef Path2 = "a/b/c.h";
10621062
#else
@@ -1077,7 +1077,7 @@ TEST(DeduplicateByFileTest, NonExistingFilePath) {
10771077
llvm::IntrusiveRefCntPtr<vfs::InMemoryFileSystem> VFS(
10781078
new vfs::InMemoryFileSystem());
10791079
FileManager FileMgr(FileSystemOptions(), VFS);
1080-
#if !defined(LLVM_ON_WIN32)
1080+
#if !defined(_WIN32)
10811081
StringRef Path1 = "./a/b/c.h";
10821082
StringRef Path2 = "a/b/c.h";
10831083
#else

clang/unittests/Tooling/ToolingTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ struct VerifyEndCallback : public SourceFileCallbacks {
216216
bool Matched;
217217
};
218218

219-
#if !defined(LLVM_ON_WIN32)
219+
#if !defined(_WIN32)
220220
TEST(newFrontendActionFactory, InjectsSourceFileCallbacks) {
221221
VerifyEndCallback EndCallback;
222222

@@ -531,7 +531,7 @@ TEST(addTargetAndModeForProgramName, IgnoresExistingMode) {
531531
ArgsAlt);
532532
}
533533

534-
#ifndef LLVM_ON_WIN32
534+
#ifndef _WIN32
535535
TEST(ClangToolTest, BuildASTs) {
536536
FixedCompilationDatabase Compilations("/", std::vector<std::string>());
537537

0 commit comments

Comments
 (0)