]> granicus.if.org Git - clang/commitdiff
[ASTImporter] Fix missing SourceLoc import for ObjCMethodDecl selectors
authorAleksei Sidorin <a.sidorin@samsung.com>
Tue, 9 Jan 2018 14:25:05 +0000 (14:25 +0000)
committerAleksei Sidorin <a.sidorin@samsung.com>
Tue, 9 Jan 2018 14:25:05 +0000 (14:25 +0000)
Patch by Nico Rieck, test case by Sean Callanan!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322079 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTImporter.cpp
test/ASTMerge/interface/Inputs/interface1.m

index cca43eed3e62bc11db042d68780fcf9d0416acd4..11d31156b8ef5089390b01f7ed92ffad4308829e 100644 (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);
index 5865c0eff070262a41970e6c74f674eb93476913..6192150089fe9284f7ebc13b4ddb741a57c97c36 100644 (file)
 @implementation I15 : I12
 @end
 
-
+@interface ImportSelectorSLoc { }
+-(int)addInt:(int)a toInt:(int)b moduloInt:(int)c; // don't crash here
+@end