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

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 25 17:26:18 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 << ')';
----------------
ahatanak wrote:

Should we still try to emit the category name (`*CID`) when the class interface (`CI`) isn't found?

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


More information about the cfe-commits mailing list