Author: Jan Svoboda
Date: 2026-01-05T20:25:09Z
New Revision: c7fe2f7a301b217ff6cfda70df06a6fc283c932e

URL: 
https://github.com/llvm/llvm-project/commit/c7fe2f7a301b217ff6cfda70df06a6fc283c932e
DIFF: 
https://github.com/llvm/llvm-project/commit/c7fe2f7a301b217ff6cfda70df06a6fc283c932e.diff

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

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

Added: 
    

Modified: 
    clang/lib/Frontend/ChainedIncludesSource.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/ChainedIncludesSource.cpp 
b/clang/lib/Frontend/ChainedIncludesSource.cpp
index 049277c2df7a9..2338698cee9d1 100644
--- a/clang/lib/Frontend/ChainedIncludesSource.cpp
+++ b/clang/lib/Frontend/ChainedIncludesSource.cpp
@@ -124,7 +124,9 @@ clang::createChainedIncludesSource(CompilerInstance &CI,
 
     auto Clang = std::make_unique<CompilerInstance>(
         std::move(CInvok), CI.getPCHContainerOperations());
-    Clang->createVirtualFileSystem();
+    // Inherit the VFS as-is: code below does not make changes to the VFS or to
+    // the VFS-affecting options.
+    Clang->setVirtualFileSystem(CI.getVirtualFileSystemPtr());
     Clang->setDiagnostics(Diags);
     Clang->setTarget(TargetInfo::CreateTargetInfo(
         Clang->getDiagnostics(), Clang->getInvocation().getTargetOpts()));


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to