Skip to content

Commit 4331c89

Browse files
committed
Adapt llvmorg-20-init-12964-gdf9a14d7bbf1: createDiagnostics
1 parent 3640f89 commit 4331c89

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

src/clang_tu.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,11 @@ buildCompilerInvocation(const std::string &main, std::vector<const char *> args,
124124
args.insert(args.begin() + 1, std::begin(arr), std::end(arr));
125125
}
126126

127-
IntrusiveRefCntPtr<DiagnosticsEngine> diags(
128-
CompilerInstance::createDiagnostics(new DiagnosticOptions,
129-
new IgnoringDiagConsumer, true));
127+
IntrusiveRefCntPtr<DiagnosticsEngine> diags(CompilerInstance::createDiagnostics(
128+
#if LLVM_VERSION_MAJOR >= 20
129+
*vfs,
130+
#endif
131+
new DiagnosticOptions, new IgnoringDiagConsumer, true));
130132
#if LLVM_VERSION_MAJOR < 12 // llvmorg-12-init-5498-g257b29715bb
131133
driver::Driver d(args[0], llvm::sys::getDefaultTargetTriple(), *diags, vfs);
132134
#else

src/indexer.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,11 @@ index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs,
13121312
IndexDiags dc;
13131313
auto clang = std::make_unique<CompilerInstance>(pch);
13141314
clang->setInvocation(std::move(ci));
1315-
clang->createDiagnostics(&dc, false);
1315+
clang->createDiagnostics(
1316+
#if LLVM_VERSION_MAJOR >= 20
1317+
*fs,
1318+
#endif
1319+
&dc, false);
13161320
clang->getDiagnostics().setIgnoreAllWarnings(true);
13171321
clang->setTarget(TargetInfo::CreateTargetInfo(
13181322
clang->getDiagnostics(), clang->getInvocation().TargetOpts));

src/sema_manager.cc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,11 @@ buildCompilerInstance(Session &session, std::unique_ptr<CompilerInvocation> ci,
288288

289289
auto clang = std::make_unique<CompilerInstance>(session.pch);
290290
clang->setInvocation(std::move(ci));
291-
clang->createDiagnostics(&dc, false);
291+
clang->createDiagnostics(
292+
#if LLVM_VERSION_MAJOR >= 20
293+
*fs,
294+
#endif
295+
&dc, false);
292296
clang->setTarget(TargetInfo::CreateTargetInfo(
293297
clang->getDiagnostics(), clang->getInvocation().TargetOpts));
294298
if (!clang->hasTarget())
@@ -368,8 +372,11 @@ void buildPreamble(Session &session, CompilerInvocation &ci,
368372
#endif
369373

370374
StoreDiags dc(task.path);
371-
IntrusiveRefCntPtr<DiagnosticsEngine> de =
372-
CompilerInstance::createDiagnostics(&ci.getDiagnosticOpts(), &dc, false);
375+
IntrusiveRefCntPtr<DiagnosticsEngine> de = CompilerInstance::createDiagnostics(
376+
#if LLVM_VERSION_MAJOR >= 20
377+
*fs,
378+
#endif
379+
&ci.getDiagnosticOpts(), &dc, false);
373380
if (oldP) {
374381
std::lock_guard lock(session.wfiles->mutex);
375382
for (auto &include : oldP->includes)

0 commit comments

Comments
 (0)