Skip to content

Commit ac81bbb

Browse files
Add compatibility to llvm-20
The function `CompilerInstance::createDiagnostics()` changed its signature in llvm-20, hence we need to check the llvm version and adjust the call properly. This also adds llvm-20 to the CI and drops llvm-17, since Tumbleweed does not provide it anymore. Signed-off-by: Giuliano Belinassi <gbelinassi@suse.de>
1 parent 8344124 commit ac81bbb

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

.github/workflows/testsuite.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
opensuse: [tumbleweed]
1616
compiler: [clang]
1717
build-type: [debug, release]
18-
version: [17, 18, 19]
18+
version: [18, 19, 20]
1919

2020
container:
2121
image: opensuse/${{ matrix.opensuse }}

libcextract/ClangCompat.hh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ namespace ClangCompat
100100
{ fentry, dentry },
101101
}};
102102
return A;
103+
#endif
104+
}
105+
106+
static inline IntrusiveRefCntPtr<DiagnosticsEngine> createDiagnostics(
107+
llvm::vfs::FileSystem &VFS,
108+
DiagnosticOptions *Opts)
109+
{
110+
#if CLANG_VERSION_MAJOR >= 20
111+
return CompilerInstance::createDiagnostics(VFS, Opts);
112+
#else
113+
return CompilerInstance::createDiagnostics(Opts);
103114
#endif
104115
}
105116
}

libcextract/Passes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static bool Build_ASTUnit(PassManager::Context *ctx, IntrusiveRefCntPtr<vfs::Fil
7979
diagopts->ShowColors = true;
8080
}
8181

82-
Diags = CompilerInstance::createDiagnostics(diagopts);
82+
Diags = ClangCompat::createDiagnostics(*_Hack_VFS, diagopts);
8383

8484
if (ctx->IgnoreClangErrors) {
8585
Diags->setWarningsAsErrors(false);

0 commit comments

Comments
 (0)