Also use the Canonical Decl to index the set of Direct methods so that
when calls and implementations interleave, the same llvm::Function is
used and the same symbol name emitted.
Add a codegen test, that cover both issues.
Also fix a bunch of code in clang that had wrong assumptions about when
getSelfDecl() would be set:
- CGDebugInfo::getObjCMethodName and AnalysisConsumer::getFunctionName would assume that it was set for method declarations part of a protocol, which they never were, and that self would be a Class type, which it isn't as it is id for a protocol.
- ASTDeclWriter::VisitObjCMethodDecl was assuming that having a SelfDecl meant that it MUST BE a method definition which is no longer true.
Radar-Id: rdar://problem/57661767
Yeah, I applied this change. As I said, for my trivial example it does work. But for my more thorough example with @property (direct) etc, it doesn't. I can dig into more later today or Monday. I just got everything work (with another more hackier fix) and would first to evaluate this as a viable path first before commit more time to debug this.
We probably can also just have a follow-up fix for that, depends on if reviewers thought this is blocking or not. I personally think not.