summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorRaphael Isemann <risemann@apple.com>2019-12-06 18:10:23 +0100
committerRaphael Isemann <risemann@apple.com>2019-12-06 18:50:32 +0100
commit164e0fc5c7f782b174db5c87b37725ea0e174853 (patch)
treeb5e9947fbf10adba718907c0ce02f8b381a841a2 /clang/lib/AST
parent50d72fa1461b71d898237f3ce19ab367d0508c87 (diff)
downloadbcm5719-llvm-164e0fc5c7f782b174db5c87b37725ea0e174853.tar.gz
bcm5719-llvm-164e0fc5c7f782b174db5c87b37725ea0e174853.zip
[ASTImporter] Implicitly declare parameters for imported ObjCMethodDecls
Summary: When Sema encounters a ObjCMethodDecl definition it declares the implicit parameters for the ObjCMethodDecl. When importing such a method with the ASTImporter we need to do the same for the imported method otherwise we will crash when generating code (where CodeGen expects that this was called by Sema). Note I had to implement Objective-C[++] support in Language.cpp as this is the first test for Objective-C and this would otherwise just hit this 'not implemented' assert when running the unit test. Reviewers: martong, a.sidorin, shafik Reviewed By: martong Subscribers: rnkovacs, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71112
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/ASTImporter.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index ff844f98bfb..7d71a4a143c 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -4010,6 +4010,14 @@ ExpectedDecl ASTNodeImporter::VisitObjCMethodDecl(ObjCMethodDecl *D) {
ToMethod->setLexicalDeclContext(LexicalDC);
LexicalDC->addDeclInternal(ToMethod);
+
+ // Implicit params are declared when Sema encounters the definition but this
+ // never happens when the method is imported. Manually declare the implicit
+ // params now that the MethodDecl knows its class interface.
+ if (D->getSelfDecl())
+ ToMethod->createImplicitParams(Importer.getToContext(),
+ ToMethod->getClassInterface());
+
return ToMethod;
}
OpenPOWER on IntegriCloud