aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Driver/ToolChainTest.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2021-10-21 18:33:24 -0700
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2021-10-29 12:09:41 -0700
commit99023627010bbfefb71e25a2b4d056de1cbd354e (patch)
treea7ad434f3071922aac052bf9eb23c29c577cb885 /clang/unittests/Driver/ToolChainTest.cpp
parent51ce567b38ec92163ec05c9bef0bd0e2bd53c667 (diff)
downloadllvm-99023627010bbfefb71e25a2b4d056de1cbd354e.zip
llvm-99023627010bbfefb71e25a2b4d056de1cbd354e.tar.gz
llvm-99023627010bbfefb71e25a2b4d056de1cbd354e.tar.bz2
Support: Use sys::path::is_style_{posix,windows}() in a few places
Use the new sys::path::is_style_posix() and is_style_windows() in a few places that need to detect the system's native path style. In llvm/lib/Support/Path.cpp, this patch removes most uses of the private `real_style()`, where is_style_posix() and is_style_windows() are just a little tidier. Elsewhere, this removes `_WIN32` macro checks. Added a FIXME to a FileManagerTest that seemed fishy, but maintained the existing behaviour. Differential Revision: https://reviews.llvm.org/D112289
Diffstat (limited to 'clang/unittests/Driver/ToolChainTest.cpp')
-rw-r--r--clang/unittests/Driver/ToolChainTest.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/clang/unittests/Driver/ToolChainTest.cpp b/clang/unittests/Driver/ToolChainTest.cpp
index 2bf727d..62ad6f7 100644
--- a/clang/unittests/Driver/ToolChainTest.cpp
+++ b/clang/unittests/Driver/ToolChainTest.cpp
@@ -85,9 +85,8 @@ TEST(ToolChainTest, VFSGCCInstallation) {
llvm::raw_string_ostream OS(S);
C->getDefaultToolChain().printVerboseInfo(OS);
}
-#if _WIN32
- std::replace(S.begin(), S.end(), '\\', '/');
-#endif
+ if (is_style_windows(llvm::sys::path::Style::native))
+ std::replace(S.begin(), S.end(), '\\', '/');
EXPECT_EQ(
"Found candidate GCC installation: "
"/usr/lib/gcc/arm-linux-gnueabihf/4.6.3\n"
@@ -110,9 +109,8 @@ TEST(ToolChainTest, VFSGCCInstallation) {
llvm::raw_string_ostream OS(S);
C->getDefaultToolChain().printVerboseInfo(OS);
}
-#if _WIN32
- std::replace(S.begin(), S.end(), '\\', '/');
-#endif
+ if (is_style_windows(llvm::sys::path::Style::native))
+ std::replace(S.begin(), S.end(), '\\', '/');
// Test that 4.5.3 from --sysroot is not overridden by 4.6.3 (larger
// version) from /usr.
EXPECT_EQ("Found candidate GCC installation: "
@@ -153,9 +151,8 @@ TEST(ToolChainTest, VFSGCCInstallationRelativeDir) {
llvm::raw_string_ostream OS(S);
C->getDefaultToolChain().printVerboseInfo(OS);
}
-#if _WIN32
- std::replace(S.begin(), S.end(), '\\', '/');
-#endif
+ if (is_style_windows(llvm::sys::path::Style::windows))
+ std::replace(S.begin(), S.end(), '\\', '/');
EXPECT_EQ("Found candidate GCC installation: "
"/home/test/bin/../lib/gcc/arm-linux-gnueabi/4.6.1\n"
"Selected GCC installation: "