[clang] Fix crash with -ast-dump=json (PR #137324)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 28 04:16:40 PDT 2025


================
@@ -367,9 +367,11 @@ void MangleContext::mangleObjCMethodName(const ObjCMethodDecl *MD,
   }
   OS << (MD->isInstanceMethod() ? '-' : '+') << '[';
   if (const auto *CID = MD->getCategory()) {
-    OS << CID->getClassInterface()->getName();
-    if (includeCategoryNamespace) {
-      OS << '(' << *CID << ')';
+    if (const auto *CI = CID->getClassInterface()) {
+      OS << CI->getName();
+      if (includeCategoryNamespace) {
+        OS << '(' << *CID << ')';
----------------
AaronBallman wrote:

I have no idea; what does Objective-C expect? CC @rjmccall ?

https://github.com/llvm/llvm-project/pull/137324


More information about the cfe-commits mailing list