aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Frontend/CompilerInstanceTest.cpp
diff options
context:
space:
mode:
authorKadir Cetinkaya <kadircet@google.com>2024-11-21 13:04:30 +0100
committerKadir Cetinkaya <kadircet@google.com>2024-11-21 14:55:30 +0100
commitdf9a14d7bbf1180e4f1474254c9d7ed6bcb4ce55 (patch)
tree4f440ad02ebb7990fda10120328a833459b1ab89 /clang/unittests/Frontend/CompilerInstanceTest.cpp
parentd800ea7cb12245f65f886e18545ba83355825246 (diff)
downloadllvm-df9a14d7bbf1180e4f1474254c9d7ed6bcb4ce55.zip
llvm-df9a14d7bbf1180e4f1474254c9d7ed6bcb4ce55.tar.gz
llvm-df9a14d7bbf1180e4f1474254c9d7ed6bcb4ce55.tar.bz2
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.
Diffstat (limited to 'clang/unittests/Frontend/CompilerInstanceTest.cpp')
-rw-r--r--clang/unittests/Frontend/CompilerInstanceTest.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/unittests/Frontend/CompilerInstanceTest.cpp b/clang/unittests/Frontend/CompilerInstanceTest.cpp
index 5cf548e9..07329eb2 100644
--- a/clang/unittests/Frontend/CompilerInstanceTest.cpp
+++ b/clang/unittests/Frontend/CompilerInstanceTest.cpp
@@ -13,6 +13,7 @@
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/ToolOutputFile.h"
+#include "llvm/Support/VirtualFileSystem.h"
#include "gtest/gtest.h"
using namespace llvm;
@@ -53,7 +54,8 @@ TEST(CompilerInstance, DefaultVFSOverlayFromInvocation) {
const char *Args[] = {"clang", VFSArg.c_str(), "-xc++", "-"};
IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
- CompilerInstance::createDiagnostics(new DiagnosticOptions());
+ CompilerInstance::createDiagnostics(*llvm::vfs::getRealFileSystem(),
+ new DiagnosticOptions());
CreateInvocationOptions CIOpts;
CIOpts.Diags = Diags;
@@ -87,8 +89,9 @@ TEST(CompilerInstance, AllowDiagnosticLogWithUnownedDiagnosticConsumer) {
auto DiagPrinter = std::make_unique<TextDiagnosticPrinter>(
DiagnosticsOS, new DiagnosticOptions());
CompilerInstance Instance;
- IntrusiveRefCntPtr<DiagnosticsEngine> Diags = Instance.createDiagnostics(
- DiagOpts, DiagPrinter.get(), /*ShouldOwnClient=*/false);
+ IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
+ Instance.createDiagnostics(*llvm::vfs::getRealFileSystem(), DiagOpts,
+ DiagPrinter.get(), /*ShouldOwnClient=*/false);
Diags->Report(diag::err_expected) << "no crash";
ASSERT_EQ(DiagnosticOutput, "error: expected no crash\n");