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
I'd rather have auto * or Decl * here.