Author: Jan Svoboda
Date: 2026-01-05T11:43:38-08:00
New Revision: afb9883c70663f273a7a785100e3edf1b769d511

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

LOG: [clang] Pass VFS to driver's `ExpansionContext` (#173292)

The `ExpansionContext` constructor calls `vfs::getRealFileSystem()` when
not given VFS explicitly, leading to sandbox violations. This PR passes
the VFS into the constructor instead of calling `setVFS()` later.

Added: 
    

Modified: 
    clang/lib/Driver/Driver.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 5dce2168236cf..b2828ebc5a4f6 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1273,8 +1273,7 @@ bool Driver::readConfigFile(StringRef FileName,
 
 bool Driver::loadConfigFiles() {
   llvm::cl::ExpansionContext ExpCtx(Saver.getAllocator(),
-                                    llvm::cl::tokenizeConfigFile);
-  ExpCtx.setVFS(&getVFS());
+                                    llvm::cl::tokenizeConfigFile, &getVFS());
 
   // Process options that change search path for config files.
   if (CLOptions) {


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

Reply via email to