[ASTImporter] Fix missing SourceLoc import for ObjCMethodDecl selectors

Patch by Nico Rieck, test case by Sean Callanan!

Differential Revision: https://reviews.llvm.org/D6550

llvm-svn: 322079
This commit is contained in:
Aleksei Sidorin 2018-01-09 14:25:05 +00:00
parent 5d909be91b
commit 47dbaf6c8e
2 changed files with 8 additions and 2 deletions

View File

@ -2857,9 +2857,13 @@ Decl *ASTNodeImporter::VisitObjCMethodDecl(ObjCMethodDecl *D) {
ToParams[I]->setOwningFunction(ToMethod);
ToMethod->addDeclInternal(ToParams[I]);
}
SmallVector<SourceLocation, 12> SelLocs;
D->getSelectorLocs(SelLocs);
ToMethod->setMethodParams(Importer.getToContext(), ToParams, SelLocs);
for (SourceLocation &Loc : SelLocs)
Loc = Importer.Import(Loc);
ToMethod->setMethodParams(Importer.getToContext(), ToParams, SelLocs);
ToMethod->setLexicalDeclContext(LexicalDC);
Importer.Imported(D, ToMethod);

View File

@ -100,4 +100,6 @@
@implementation I15 : I12
@end
@interface ImportSelectorSLoc { }
-(int)addInt:(int)a toInt:(int)b moduloInt:(int)c; // don't crash here
@end