llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-driver

Author: Jan Svoboda (jansvoboda11)

<details>
<summary>Changes</summary>

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.

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


1 Files Affected:

- (modified) clang/lib/Driver/Driver.cpp (+1-2) 


``````````diff
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 6a2ee1794b7d7..c45cf049d8c6b 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) {

``````````

</details>


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

Reply via email to