aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/FrontendAction.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2025-09-18 11:07:40 -0700
committerGitHub <noreply@github.com>2025-09-18 11:07:40 -0700
commitcda542dd21eb550c58b398f1a47216ed55edf72d (patch)
treec9399fc7a04b54656bbf5c2f202ff6dc8c99f761 /clang/lib/Frontend/FrontendAction.cpp
parentb59af5cc9c7f6794a51db189521cad22d97a1605 (diff)
downloadllvm-cda542dd21eb550c58b398f1a47216ed55edf72d.zip
llvm-cda542dd21eb550c58b398f1a47216ed55edf72d.tar.gz
llvm-cda542dd21eb550c58b398f1a47216ed55edf72d.tar.bz2
[clang] Pass VFS into `ASTUnit::LoadFromASTFile()` (#159166)
This PR makes the `VFS` parameter to `ASTUnit::LoadFromASTFile()` required and explicit, rather than silently defaulting to the real file system. This makes it easy to correctly propagate the fully-configured VFS and load any input files like the rest of the compiler does.
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r--clang/lib/Frontend/FrontendAction.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index ca37e06..6cc3b65 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -864,7 +864,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromASTFile(
InputFile, CI.getPCHContainerReader(), ASTUnit::LoadPreprocessorOnly,
- nullptr, ASTDiags, CI.getFileSystemOpts(), CI.getHeaderSearchOpts());
+ CI.getVirtualFileSystemPtr(), nullptr, ASTDiags, CI.getFileSystemOpts(),
+ CI.getHeaderSearchOpts());
if (!AST)
return false;
@@ -931,9 +932,9 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
StringRef InputFile = Input.getFile();
std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromASTFile(
- InputFile, CI.getPCHContainerReader(), ASTUnit::LoadEverything, nullptr,
- Diags, CI.getFileSystemOpts(), CI.getHeaderSearchOpts(),
- &CI.getLangOpts());
+ InputFile, CI.getPCHContainerReader(), ASTUnit::LoadEverything,
+ CI.getVirtualFileSystemPtr(), nullptr, Diags, CI.getFileSystemOpts(),
+ CI.getHeaderSearchOpts(), &CI.getLangOpts());
if (!AST)
return false;