llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Steven Wu (cachemeifyoucan)

<details>
<summary>Changes</summary>

expandResponseFiles() created the llvm::cl::ExpansionContext without a
file system and only set the provided VFS afterwards. The constructor
falls back to vfs::getRealFileSystem() when no file system is given, so
the real file system was always obtained even when the caller provided
a VFS. With the IO sandbox enabled, this is a sandbox violation, e.g.
when the dependency scanner builds a compilation for a by-name query.

Pass the VFS to the constructor instead.


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


1 Files Affected:

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


``````````diff
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 9d95f69f1bbfe..54daa1c4fb5c5 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -6676,10 +6676,8 @@ llvm::Error 
driver::expandResponseFiles(SmallVectorImpl<const char *> &Args,
   if (MarkEOLs && Args.size() > 1 && StringRef(Args[1]).starts_with("-cc1"))
     MarkEOLs = false;
 
-  llvm::cl::ExpansionContext ECtx(Alloc, Tokenizer);
+  llvm::cl::ExpansionContext ECtx(Alloc, Tokenizer, FS);
   ECtx.setMarkEOLs(MarkEOLs);
-  if (FS)
-    ECtx.setVFS(FS);
 
   if (llvm::Error Err = ECtx.expandResponseFiles(Args))
     return Err;

``````````

</details>


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

Reply via email to