[clang-tools-extra] [clang-tidy] Fix loading clang-tidy as a Clang frontend plugin (PR #221961)

Zeyi Xu via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 8 04:36:26 PDT 2026


================
@@ -67,7 +77,8 @@ class ClangTidyPluginAction : public PluginASTAction {
         OverrideOptions.Checks = std::string(Arg.substr(strlen("-checks=")));
 
     auto Options = std::make_unique<FileOptionsProvider>(
-        GlobalOptions, DefaultOptions, OverrideOptions);
+        GlobalOptions, DefaultOptions, OverrideOptions,
+        Compiler.getVirtualFileSystemPtr());
----------------
zeyi2 wrote:

Without this argument, the options provider falls back to [getRealFileSystem()](https://github.com/llvm/llvm-project/blob/2449bae16b32b994282263be4cf1ece9441032f3/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp#L371-L379), which causes an IO sandbox violation when the sandbox is enabled. Reusing the compiler's VFS also respects its filesystem overlays.

https://github.com/llvm/llvm-project/pull/221961


More information about the cfe-commits mailing list