|
| 1 | +From 4c7be1ec6ab74e973f8d18a9011fa349c3d9dd58 Mon Sep 17 00:00:00 2001 |
| 2 | +From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= <holger@applied-asynchrony.com> |
| 3 | +Date: Mon, 2 Mar 2026 10:03:15 +0100 |
| 4 | +Subject: [PATCH] Fix build with LLVM-22 |
| 5 | +MIME-Version: 1.0 |
| 6 | +Content-Type: text/plain; charset=UTF-8 |
| 7 | +Content-Transfer-Encoding: 8bit |
| 8 | + |
| 9 | +LLVM-22 changed the signatures of various createDiagnostics() calls [1]. |
| 10 | +Introduce a new version macro guard and adapt the code to the changed API. |
| 11 | + |
| 12 | +Fixes #5483 |
| 13 | + |
| 14 | +[1] https://github.com/llvm/llvm-project/commit/30633f30894129919050f24fdd1f8f6bc46beae0 |
| 15 | + |
| 16 | +Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com> |
| 17 | +--- |
| 18 | + src/cc/frontends/clang/loader.cc | 15 ++++++++++++--- |
| 19 | + 1 file changed, 12 insertions(+), 3 deletions(-) |
| 20 | + |
| 21 | +diff --git a/src/cc/frontends/clang/loader.cc b/src/cc/frontends/clang/loader.cc |
| 22 | +index 6f8387aaf017..1f706344724d 100644 |
| 23 | +--- a/src/cc/frontends/clang/loader.cc |
| 24 | ++++ b/src/cc/frontends/clang/loader.cc |
| 25 | +@@ -464,7 +464,10 @@ int ClangLoader::do_compile( |
| 26 | + } |
| 27 | + invocation0.getFrontendOpts().DisableFree = false; |
| 28 | + |
| 29 | +-#if LLVM_VERSION_MAJOR >= 20 |
| 30 | ++#if LLVM_VERSION_MAJOR >= 22 |
| 31 | ++ compiler0.setVirtualFileSystem(llvm::vfs::getRealFileSystem()); |
| 32 | ++ compiler0.createDiagnostics(new IgnoringDiagConsumer()); |
| 33 | ++#elif LLVM_VERSION_MAJOR >= 20 |
| 34 | + compiler0.createDiagnostics(*llvm::vfs::getRealFileSystem(), new IgnoringDiagConsumer()); |
| 35 | + #else |
| 36 | + compiler0.createDiagnostics(new IgnoringDiagConsumer()); |
| 37 | +@@ -487,7 +490,10 @@ int ClangLoader::do_compile( |
| 38 | + add_main_input(invocation1, main_path, &*out_buf); |
| 39 | + invocation1.getFrontendOpts().DisableFree = false; |
| 40 | + |
| 41 | +-#if LLVM_VERSION_MAJOR >= 20 |
| 42 | ++#if LLVM_VERSION_MAJOR >= 22 |
| 43 | ++ compiler1.setVirtualFileSystem(llvm::vfs::getRealFileSystem()); |
| 44 | ++ compiler1.createDiagnostics(); |
| 45 | ++#elif LLVM_VERSION_MAJOR >= 20 |
| 46 | + compiler1.createDiagnostics(*llvm::vfs::getRealFileSystem()); |
| 47 | + #else |
| 48 | + compiler1.createDiagnostics(); |
| 49 | +@@ -517,7 +523,10 @@ int ClangLoader::do_compile( |
| 50 | + invocation2.getCodeGenOpts().setInlining(CodeGenOptions::NormalInlining); |
| 51 | + // suppress warnings in the 2nd pass, but bail out on errors (our fault) |
| 52 | + invocation2.getDiagnosticOpts().IgnoreWarnings = true; |
| 53 | +-#if LLVM_VERSION_MAJOR >= 20 |
| 54 | ++#if LLVM_VERSION_MAJOR >= 22 |
| 55 | ++ compiler2.setVirtualFileSystem(llvm::vfs::getRealFileSystem()); |
| 56 | ++ compiler2.createDiagnostics(); |
| 57 | ++#elif LLVM_VERSION_MAJOR >= 20 |
| 58 | + compiler2.createDiagnostics(*llvm::vfs::getRealFileSystem()); |
| 59 | + #else |
| 60 | + compiler2.createDiagnostics(); |
0 commit comments