Port //toolchain/install to new filesystem library (#5905)

This removes a bunch of manual filesystem helpers and complexity that
are directly provided by the new library.

It also moves all of the install paths detection to use
`std::filesystem::path` instead of the LLVM path library. The goal is to
consolidate all our logic onto a single stack, and the standard one
seems the best for that purpose. This does give up some of the
optimizations of this code to avoid memory allocation, but in practice
that likely isn't a critical issue. And with the new filesystem library
we can likely do more to avoid that by using directory-object-relative
filesystem access. However, that will have to wait for moving more parts
of the toolchain over to use this set of filesystem abstractions. There
is a related TODO left in the manifest handling code.
This commit is contained in:
Chandler Carruth
2025-08-12 02:20:22 +00:00
committed by GitHub
parent 42d29764c0
commit 2e509e9103
11 changed files with 264 additions and 289 deletions
+3 -3
View File
@@ -224,7 +224,7 @@ auto ToolchainFileTest::GetDefaultArgs() const
"--phase=" + component_.str(),
// Use the install path to exclude prelude files.
"--exclude-dump-file-prefix=" +
data_->installation.core_package(),
data_->installation.core_package().native(),
});
if (component_ == "lex") {
@@ -315,8 +315,8 @@ auto ToolchainFileTest::DoExtraCheckReplacements(std::string& check_line) const
// TODO: Consider adding a content keyword to name the core package, and
// replace with that instead. Alternatively, consider adding the core
// package to the VFS with a fixed name.
absl::StrReplaceAll({{data_->installation.core_package(), "{{.*}}"}},
&check_line);
absl::StrReplaceAll(
{{data_->installation.core_package().native(), "{{.*}}"}}, &check_line);
if (component_ == "check") {
DoClangASTCheckReplacements(check_line);
}