From bdd10d9d249bd1c2a45e3de56a5accd97e953458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kadir=20=C3=A7etinkaya?= Date: Thu, 21 Nov 2024 12:11:41 +0100 Subject: [NFC] Explicitly pass a VFS when creating DiagnosticsEngine (#115852) Starting with 41e3919ded78d8870f7c95e9181c7f7e29aa3cc4 DiagnosticsEngine creation might perform IO. It was implicitly defaulting to getRealFileSystem. This patch makes it explicit by pushing the decision making to callers. It uses ambient VFS if one is available, and keeps using `getRealFileSystem` if there aren't any VFS. --- clang/unittests/Frontend/CompilerInvocationTest.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'clang/unittests/Frontend/CompilerInvocationTest.cpp') diff --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp b/clang/unittests/Frontend/CompilerInvocationTest.cpp index 45478de..4ff6824 100644 --- a/clang/unittests/Frontend/CompilerInvocationTest.cpp +++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp @@ -12,6 +12,7 @@ #include "clang/Frontend/TextDiagnosticBuffer.h" #include "clang/Lex/PreprocessorOptions.h" #include "clang/Serialization/ModuleFileExtension.h" +#include "llvm/Support/VirtualFileSystem.h" #include "llvm/TargetParser/Host.h" #include "gmock/gmock.h" @@ -38,9 +39,9 @@ public: } CommandLineTest() - : Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions(), - new TextDiagnosticBuffer())) { - } + : Diags(CompilerInstance::createDiagnostics( + *llvm::vfs::getRealFileSystem(), new DiagnosticOptions(), + new TextDiagnosticBuffer())) {} }; template -- cgit v1.1