Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
clang/unittests/Driver/ToolChainTest.cpp
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | for (const char *Path : EmptyFiles) | ||||
std::unique_ptr<Compilation> C(TheDriver.BuildCompilation( | std::unique_ptr<Compilation> C(TheDriver.BuildCompilation( | ||||
{"-fsyntax-only", "--gcc-toolchain=", "--sysroot=", "foo.cpp"})); | {"-fsyntax-only", "--gcc-toolchain=", "--sysroot=", "foo.cpp"})); | ||||
ASSERT_TRUE(C); | ASSERT_TRUE(C); | ||||
std::string S; | std::string S; | ||||
{ | { | ||||
llvm::raw_string_ostream OS(S); | llvm::raw_string_ostream OS(S); | ||||
C->getDefaultToolChain().printVerboseInfo(OS); | C->getDefaultToolChain().printVerboseInfo(OS); | ||||
} | } | ||||
#if _WIN32 | if (is_style_windows(llvm::sys::path::Style::native)) | ||||
std::replace(S.begin(), S.end(), '\\', '/'); | std::replace(S.begin(), S.end(), '\\', '/'); | ||||
#endif | |||||
EXPECT_EQ( | EXPECT_EQ( | ||||
"Found candidate GCC installation: " | "Found candidate GCC installation: " | ||||
"/usr/lib/gcc/arm-linux-gnueabihf/4.6.3\n" | "/usr/lib/gcc/arm-linux-gnueabihf/4.6.3\n" | ||||
"Selected GCC installation: /usr/lib/gcc/arm-linux-gnueabihf/4.6.3\n" | "Selected GCC installation: /usr/lib/gcc/arm-linux-gnueabihf/4.6.3\n" | ||||
"Candidate multilib: .;@m32\n" | "Candidate multilib: .;@m32\n" | ||||
"Selected multilib: .;@m32\n", | "Selected multilib: .;@m32\n", | ||||
S); | S); | ||||
} | } | ||||
{ | { | ||||
DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer); | DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer); | ||||
Driver TheDriver("/bin/clang", "arm-linux-gnueabihf", Diags, | Driver TheDriver("/bin/clang", "arm-linux-gnueabihf", Diags, | ||||
"clang LLVM compiler", InMemoryFileSystem); | "clang LLVM compiler", InMemoryFileSystem); | ||||
std::unique_ptr<Compilation> C(TheDriver.BuildCompilation( | std::unique_ptr<Compilation> C(TheDriver.BuildCompilation( | ||||
{"-fsyntax-only", "--gcc-toolchain=", "--sysroot=/sysroot", | {"-fsyntax-only", "--gcc-toolchain=", "--sysroot=/sysroot", | ||||
"foo.cpp"})); | "foo.cpp"})); | ||||
ASSERT_TRUE(C); | ASSERT_TRUE(C); | ||||
std::string S; | std::string S; | ||||
{ | { | ||||
llvm::raw_string_ostream OS(S); | llvm::raw_string_ostream OS(S); | ||||
C->getDefaultToolChain().printVerboseInfo(OS); | C->getDefaultToolChain().printVerboseInfo(OS); | ||||
} | } | ||||
#if _WIN32 | if (is_style_windows(llvm::sys::path::Style::native)) | ||||
std::replace(S.begin(), S.end(), '\\', '/'); | std::replace(S.begin(), S.end(), '\\', '/'); | ||||
#endif | |||||
// Test that 4.5.3 from --sysroot is not overridden by 4.6.3 (larger | // Test that 4.5.3 from --sysroot is not overridden by 4.6.3 (larger | ||||
// version) from /usr. | // version) from /usr. | ||||
EXPECT_EQ("Found candidate GCC installation: " | EXPECT_EQ("Found candidate GCC installation: " | ||||
"/sysroot/usr/lib/gcc/arm-linux-gnueabihf/4.5.3\n" | "/sysroot/usr/lib/gcc/arm-linux-gnueabihf/4.5.3\n" | ||||
"Selected GCC installation: " | "Selected GCC installation: " | ||||
"/sysroot/usr/lib/gcc/arm-linux-gnueabihf/4.5.3\n" | "/sysroot/usr/lib/gcc/arm-linux-gnueabihf/4.5.3\n" | ||||
"Candidate multilib: .;@m32\n" | "Candidate multilib: .;@m32\n" | ||||
"Selected multilib: .;@m32\n", | "Selected multilib: .;@m32\n", | ||||
Show All 24 Lines | std::unique_ptr<Compilation> C(TheDriver.BuildCompilation( | ||||
{"-fsyntax-only", "--gcc-toolchain=", "foo.cpp"})); | {"-fsyntax-only", "--gcc-toolchain=", "foo.cpp"})); | ||||
EXPECT_TRUE(C); | EXPECT_TRUE(C); | ||||
std::string S; | std::string S; | ||||
{ | { | ||||
llvm::raw_string_ostream OS(S); | llvm::raw_string_ostream OS(S); | ||||
C->getDefaultToolChain().printVerboseInfo(OS); | C->getDefaultToolChain().printVerboseInfo(OS); | ||||
} | } | ||||
#if _WIN32 | if (is_style_windows(llvm::sys::path::Style::windows)) | ||||
std::replace(S.begin(), S.end(), '\\', '/'); | std::replace(S.begin(), S.end(), '\\', '/'); | ||||
#endif | |||||
EXPECT_EQ("Found candidate GCC installation: " | EXPECT_EQ("Found candidate GCC installation: " | ||||
"/home/test/bin/../lib/gcc/arm-linux-gnueabi/4.6.1\n" | "/home/test/bin/../lib/gcc/arm-linux-gnueabi/4.6.1\n" | ||||
"Selected GCC installation: " | "Selected GCC installation: " | ||||
"/home/test/bin/../lib/gcc/arm-linux-gnueabi/4.6.1\n" | "/home/test/bin/../lib/gcc/arm-linux-gnueabi/4.6.1\n" | ||||
"Candidate multilib: .;@m32\n" | "Candidate multilib: .;@m32\n" | ||||
"Selected multilib: .;@m32\n", | "Selected multilib: .;@m32\n", | ||||
S); | S); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 201 Lines • Show Last 20 Lines |