[clang] [clang] Reuse configured VFS for chained includes (PR #173288)

via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 22 09:45:44 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Jan Svoboda (jansvoboda11)

<details>
<summary>Changes</summary>

This PR propagates the already-configured VFS when handling chained includes, preventing unexpected use of the real FS and sandbox violations.

---
Full diff: https://github.com/llvm/llvm-project/pull/173288.diff


1 Files Affected:

- (modified) clang/lib/Frontend/ChainedIncludesSource.cpp (+1-1) 


``````````diff
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()));

``````````

</details>


https://github.com/llvm/llvm-project/pull/173288


More information about the cfe-commits mailing list