diff mbox series

[meta-oe,1/2] castxml: Fix build with LLVM 23

Message ID 20260829060520.2905173-2-sunilkumar.dora@windriver.com
State New
Headers show
Series Fix bcc and castxml builds with LLVM 23 | expand

Commit Message

Dora, Sunil Kumar Aug. 29, 2026, 6:05 a.m. UTC
From: Sunil Dora <sunilkumar.dora@windriver.com>

Clang 23 renamed ASTContext::getRawCommentForDeclNoCache to
getRawCommentNoCache, so castxml no longer builds:

  src/Output.cxx:1976:47: error: 'const class clang::ASTContext' has no
  member named 'getRawCommentForDeclNoCache'; did you mean
  'getRawCommentNoCache'?

Backport the upstream fix. It is guarded on LLVM_VERSION_MAJOR so older
Clang keeps working. There is no release carrying it yet; v0.7.0 is
still the newest tag.

Co-authored-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
---
 .../castxml/0001-Port-to-LLVM-Clang-23.patch  | 36 +++++++++++++++++++
 .../recipes-devtools/castxml/castxml_0.7.0.bb |  4 ++-
 2 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-devtools/castxml/castxml/0001-Port-to-LLVM-Clang-23.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/castxml/castxml/0001-Port-to-LLVM-Clang-23.patch b/meta-oe/recipes-devtools/castxml/castxml/0001-Port-to-LLVM-Clang-23.patch
new file mode 100644
index 0000000000..9caabdcf2a
--- /dev/null
+++ b/meta-oe/recipes-devtools/castxml/castxml/0001-Port-to-LLVM-Clang-23.patch
@@ -0,0 +1,36 @@ 
+From 315fbacc4e4b9c7ea21d25ad489a90b73a526326 Mon Sep 17 00:00:00 2001
+From: Brad King <brad.king@kitware.com>
+Date: Wed, 10 Jun 2026 10:55:10 -0400
+Subject: [PATCH] Port to LLVM/Clang Git main as of 2026-10-10 (6f47b6de08)
+
+Upstream-Status: Backport [https://github.com/CastXML/CastXML/commit/315fbacc4e4b]
+
+Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
+---
+ src/Output.cxx | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/Output.cxx b/src/Output.cxx
+index bb986d4b..9f722efd 100644
+--- a/src/Output.cxx
++++ b/src/Output.cxx
+@@ -119,6 +119,10 @@ clang::NestedNameSpecifier const& deref(NestedNameSpecifier const& nns)
+ #  define isPureVirtual isPure
+ #endif
+ 
++#if LLVM_VERSION_MAJOR < 23
++#  define getRawCommentNoCache getRawCommentForDeclNoCache
++#endif
++
+ class ASTVisitorBase
+ {
+ protected:
+@@ -1973,7 +1977,7 @@ void ASTVisitor::PrintCommentAttribute(clang::Decl const* d,
+   if (!this->Opts.CastXml) {
+     return;
+   }
+-  if (clang::RawComment const* rc = this->CTX.getRawCommentForDeclNoCache(d)) {
++  if (clang::RawComment const* rc = this->CTX.getRawCommentNoCache(d)) {
+     unsigned int index = ++this->CommentCount;
+     CommentEntry e = { index, rc, dn };
+     this->CommentQueue.push(e);
diff --git a/meta-oe/recipes-devtools/castxml/castxml_0.7.0.bb b/meta-oe/recipes-devtools/castxml/castxml_0.7.0.bb
index 43eeeeace7..d052f56320 100644
--- a/meta-oe/recipes-devtools/castxml/castxml_0.7.0.bb
+++ b/meta-oe/recipes-devtools/castxml/castxml_0.7.0.bb
@@ -3,7 +3,9 @@  LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
 
 SRCREV = "2d52b47cfd88b703d3247f77bb7c3ad7372bc9cb"
-SRC_URI = "git://github.com/CastXML/CastXML;protocol=https;branch=master;tag=v${PV}"
+SRC_URI = "git://github.com/CastXML/CastXML;protocol=https;branch=master;tag=v${PV} \
+           file://0001-Port-to-LLVM-Clang-23.patch \
+           "
 
 DEPENDS = "clang"