[clang] [clang] Reuse configured VFS for chained includes (PR #173288)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 22 09:45:10 PST 2025
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/173288
This PR propagates the already-configured VFS when handling chained includes, preventing unexpected use of the real FS and sandbox violations.
>From 562953106a2679bc1bba961d512c173fe83220d4 Mon Sep 17 00:00:00 2001
From: Jan Svoboda <jan_svoboda at apple.com>
Date: Mon, 22 Dec 2025 09:12:08 -0800
Subject: [PATCH] [clang] Reuse configured VFS for chained includes
---
clang/lib/Frontend/ChainedIncludesSource.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/Frontend/ChainedIncludesSource.cpp b/clang/lib/Frontend/ChainedIncludesSource.cpp
index 049277c2df7a9..048ce03d09a3e 100644
--- a/clang/lib/Frontend/ChainedIncludesSource.cpp
+++ b/clang/lib/Frontend/ChainedIncludesSource.cpp
@@ -124,7 +124,7 @@ clang::createChainedIncludesSource(CompilerInstance &CI,
auto Clang = std::make_unique<CompilerInstance>(
std::move(CInvok), CI.getPCHContainerOperations());
- Clang->createVirtualFileSystem();
+ Clang->setVirtualFileSystem(CI.getVirtualFileSystemPtr());
Clang->setDiagnostics(Diags);
Clang->setTarget(TargetInfo::CreateTargetInfo(
Clang->getDiagnostics(), Clang->getInvocation().getTargetOpts()));
More information about the cfe-commits
mailing list