Skip to content

Commit df9a14d

Browse files
committedNov 21, 2024··
Reapply "[NFC] Explicitly pass a VFS when creating DiagnosticsEngine (#115852)"
This reverts commit a1153cd with fixes to lldb breakages. Fixes #117145.
1 parent d800ea7 commit df9a14d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+197
-138
lines changed
 

‎clang-tools-extra/clang-include-fixer/IncludeFixer.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ bool IncludeFixerActionFactory::runInvocation(
9595

9696
// Create the compiler's actual diagnostics engine. We want to drop all
9797
// diagnostics here.
98-
Compiler.createDiagnostics(new clang::IgnoringDiagConsumer,
98+
Compiler.createDiagnostics(Files->getVirtualFileSystem(),
99+
new clang::IgnoringDiagConsumer,
99100
/*ShouldOwnClient=*/true);
100101
Compiler.createSourceManager(*Files);
101102

‎clang-tools-extra/clangd/Compiler.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ buildCompilerInvocation(const ParseInputs &Inputs, clang::DiagnosticConsumer &D,
110110
CIOpts.VFS = Inputs.TFS->view(Inputs.CompileCommand.Directory);
111111
CIOpts.CC1Args = CC1Args;
112112
CIOpts.RecoverOnError = true;
113-
CIOpts.Diags =
114-
CompilerInstance::createDiagnostics(new DiagnosticOptions, &D, false);
113+
CIOpts.Diags = CompilerInstance::createDiagnostics(
114+
*CIOpts.VFS, new DiagnosticOptions, &D, false);
115115
CIOpts.ProbePrecompiled = false;
116116
std::unique_ptr<CompilerInvocation> CI = createInvocation(ArgStrs, CIOpts);
117117
if (!CI)
@@ -148,7 +148,7 @@ prepareCompilerInstance(std::unique_ptr<clang::CompilerInvocation> CI,
148148
auto Clang = std::make_unique<CompilerInstance>(
149149
std::make_shared<PCHContainerOperations>());
150150
Clang->setInvocation(std::move(CI));
151-
Clang->createDiagnostics(&DiagsClient, false);
151+
Clang->createDiagnostics(*VFS, &DiagsClient, false);
152152

153153
if (auto VFSWithRemapping = createVFSFromCompilerInvocation(
154154
Clang->getInvocation(), Clang->getDiagnostics(), VFS))

0 commit comments

Comments
 (0)
Please sign in to comment.