[clang] [clang-tools-extra] [NFC] Explicitly pass a VFS when creating DiagnosticsEngine (PR #115852)

Boaz Brickner via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 04:18:28 PST 2024


================
@@ -332,23 +332,20 @@ static void SetupSerializedDiagnostics(DiagnosticOptions *DiagOpts,
   }
 }
 
-void CompilerInstance::createDiagnostics(DiagnosticConsumer *Client,
+void CompilerInstance::createDiagnostics(llvm::vfs::FileSystem &VFS,
+                                         DiagnosticConsumer *Client,
                                          bool ShouldOwnClient) {
-  Diagnostics = createDiagnostics(
-      &getDiagnosticOpts(), Client, ShouldOwnClient, &getCodeGenOpts(),
-      FileMgr ? FileMgr->getVirtualFileSystemPtr() : nullptr);
+  Diagnostics = createDiagnostics(VFS, &getDiagnosticOpts(), Client,
+                                  ShouldOwnClient, &getCodeGenOpts());
 }
 
 IntrusiveRefCntPtr<DiagnosticsEngine> CompilerInstance::createDiagnostics(
-    DiagnosticOptions *Opts, DiagnosticConsumer *Client, bool ShouldOwnClient,
-    const CodeGenOptions *CodeGenOpts,
-    llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS) {
+    llvm::vfs::FileSystem &VFS, DiagnosticOptions *Opts,
+    DiagnosticConsumer *Client, bool ShouldOwnClient,
+    const CodeGenOptions *CodeGenOpts) {
   IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  IntrusiveRefCntPtr<DiagnosticsEngine>
-      Diags(new DiagnosticsEngine(DiagID, Opts));
-
-  if (!VFS)
-    VFS = llvm::vfs::getRealFileSystem();
+  IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+      new DiagnosticsEngine(DiagID, Opts));
----------------
bricknerb wrote:

Why is this modified?
Is this just formatting?

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


More information about the cfe-commits mailing list