================
@@ -865,6 +865,24 @@ ObjCMethodDecl 
*ObjCMethodDecl::CreateDeserialized(ASTContext &C,
                                     Selector(), QualType(), nullptr, nullptr);
 }
 
+void ObjCMethodDecl::getNameForDiagnostic(raw_ostream &OS,
+                                          const PrintingPolicy &Policy,
+                                          bool Qualified) const {
+  if (Qualified) {
+    OS << (isInstanceMethod() ? '-' : '+');
+    OS << '[';
+    if (const auto *ID = getClassInterface())
+      OS << ID->getName();
+    else if (const auto *PD = dyn_cast<ObjCProtocolDecl>(getDeclContext()))
+      OS << PD->getName();
+    else
+      OS << "<Unknown>";
----------------
steakhal wrote:

I worry about code coverage and dead code. Are these defensive checks warranted?
I was looking at `ObjCPropertyDecl::getNameForDiagnostic` and it had quite some.
Can we cover them or think of plausible scenarios when they could occur?

https://github.com/llvm/llvm-project/pull/213030
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to