castxml: Fix build with LLVM 23

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>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Sunil Dora
2026-08-29 10:41:46 -07:00
committed by Khem Raj
co-authored by Deepesh Varatharajan
parent 1a71a3e63f
commit 3e3ed6643b
2 changed files with 39 additions and 1 deletions
@@ -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);
@@ -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"