jrtc27 updated this revision to Diff 328773.
jrtc27 added a comment.
... and another accidental change
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98113/new/
https://reviews.llvm.org/D98113
Files:
clang/lib/Driver/ToolChain.cpp
clang/test/Driver/Inputs/baremetal_sysroot_with_compiler_rt/lib/libclang_rt.builtins-riscv64.a
clang/test/Driver/baremetal-sysroot-with-compiler-rt.c
Index: clang/test/Driver/baremetal-sysroot-with-compiler-rt.c
===================================================================
--- /dev/null
+++ clang/test/Driver/baremetal-sysroot-with-compiler-rt.c
@@ -0,0 +1,6 @@
+// RUN: %clang -target riscv64 \
+// RUN: --sysroot=%S/Inputs/baremetal_sysroot_with_compiler_rt \
+// RUN: -rtlib=compiler-rt \
+// RUN: -print-libgcc-file-name \
+// RUN: | FileCheck %s
+// CHECK:
{{.*[/\\]}}Inputs/baremetal_sysroot_with_compiler_rt{{[/\\]}}lib{{[/\\]}}libclang_rt.builtins-riscv64.a
Index: clang/lib/Driver/ToolChain.cpp
===================================================================
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -459,12 +459,22 @@
// Check for runtime files in the new layout without the architecture first.
std::string CRTBasename =
buildCompilerRTBasename(Args, Component, Type, /*AddArch=*/false);
- for (const auto &LibPath : getLibraryPaths()) {
- SmallString<128> P(LibPath);
- llvm::sys::path::append(P, CRTBasename);
- if (getVFS().exists(P))
- return std::string(P.str());
- }
+ auto SearchPaths = [&](const llvm::SmallVectorImpl<std::string> &Paths)
+ -> llvm::Optional<std::string> {
+ for (const auto &LibPath : Paths) {
+ SmallString<128> P(LibPath);
+ llvm::sys::path::append(P, CRTBasename);
+ if (getVFS().exists(P))
+ return std::string(P.str());
+ }
+ return None;
+ };
+
+ if (auto P = SearchPaths(getLibraryPaths()))
+ return *P;
+
+ if (auto P = SearchPaths(getFilePaths()))
+ return *P;
// Fall back to the old expected compiler-rt name if the new one does not
// exist.
Index: clang/test/Driver/baremetal-sysroot-with-compiler-rt.c
===================================================================
--- /dev/null
+++ clang/test/Driver/baremetal-sysroot-with-compiler-rt.c
@@ -0,0 +1,6 @@
+// RUN: %clang -target riscv64 \
+// RUN: --sysroot=%S/Inputs/baremetal_sysroot_with_compiler_rt \
+// RUN: -rtlib=compiler-rt \
+// RUN: -print-libgcc-file-name \
+// RUN: | FileCheck %s
+// CHECK: {{.*[/\\]}}Inputs/baremetal_sysroot_with_compiler_rt{{[/\\]}}lib{{[/\\]}}libclang_rt.builtins-riscv64.a
Index: clang/lib/Driver/ToolChain.cpp
===================================================================
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -459,12 +459,22 @@
// Check for runtime files in the new layout without the architecture first.
std::string CRTBasename =
buildCompilerRTBasename(Args, Component, Type, /*AddArch=*/false);
- for (const auto &LibPath : getLibraryPaths()) {
- SmallString<128> P(LibPath);
- llvm::sys::path::append(P, CRTBasename);
- if (getVFS().exists(P))
- return std::string(P.str());
- }
+ auto SearchPaths = [&](const llvm::SmallVectorImpl<std::string> &Paths)
+ -> llvm::Optional<std::string> {
+ for (const auto &LibPath : Paths) {
+ SmallString<128> P(LibPath);
+ llvm::sys::path::append(P, CRTBasename);
+ if (getVFS().exists(P))
+ return std::string(P.str());
+ }
+ return None;
+ };
+
+ if (auto P = SearchPaths(getLibraryPaths()))
+ return *P;
+
+ if (auto P = SearchPaths(getFilePaths()))
+ return *P;
// Fall back to the old expected compiler-rt name if the new one does not
// exist.
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits