[clang] [clang] Pass VFS to driver's `ExpansionContext` (PR #173292)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 22 10:22:09 PST 2025
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/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.
>From dc0ea8fe41cb329347d3433cfb40613cd9f310ca Mon Sep 17 00:00:00 2001
From: Jan Svoboda <jan_svoboda at apple.com>
Date: Mon, 22 Dec 2025 10:20:31 -0800
Subject: [PATCH] [clang] Pass VFS to driver's `ExpansionContext`
---
clang/lib/Driver/Driver.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
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) {
More information about the cfe-commits
mailing list