From df9a14d7bbf1180e4f1474254c9d7ed6bcb4ce55 Mon Sep 17 00:00:00 2001 From: Kadir Cetinkaya Date: Thu, 21 Nov 2024 13:04:30 +0100 Subject: Reapply "[NFC] Explicitly pass a VFS when creating DiagnosticsEngine (#115852)" This reverts commit a1153cd6fedd4c906a9840987934ca4712e34cb2 with fixes to lldb breakages. Fixes https://github.com/llvm/llvm-project/issues/117145. --- clang/lib/Frontend/CreateInvocationFromCommandLine.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'clang/lib/Frontend/CreateInvocationFromCommandLine.cpp') diff --git a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp index 638757a..d0b855f 100644 --- a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -22,6 +22,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" #include "llvm/Option/ArgList.h" +#include "llvm/Support/VirtualFileSystem.h" #include "llvm/TargetParser/Host.h" using namespace clang; using namespace llvm::opt; @@ -32,7 +33,9 @@ clang::createInvocation(ArrayRef ArgList, assert(!ArgList.empty()); auto Diags = Opts.Diags ? std::move(Opts.Diags) - : CompilerInstance::createDiagnostics(new DiagnosticOptions); + : CompilerInstance::createDiagnostics( + Opts.VFS ? *Opts.VFS : *llvm::vfs::getRealFileSystem(), + new DiagnosticOptions); SmallVector Args(ArgList); -- cgit v1.1