r322079 - [ASTImporter] Fix missing SourceLoc import for ObjCMethodDecl selectors
Aleksei Sidorin via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 9 06:25:05 PST 2018
Author: a.sidorin
Date: Tue Jan 9 06:25:05 2018
New Revision: 322079
URL: http://llvm.org/viewvc/llvm-project?rev=322079&view=rev
Log:
[ASTImporter] Fix missing SourceLoc import for ObjCMethodDecl selectors
Patch by Nico Rieck, test case by Sean Callanan!
Differential Revision: https://reviews.llvm.org/D6550
Modified:
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/test/ASTMerge/interface/Inputs/interface1.m
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=322079&r1=322078&r2=322079&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Tue Jan 9 06:25:05 2018
@@ -2857,9 +2857,13 @@ Decl *ASTNodeImporter::VisitObjCMethodDe
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);
Modified: cfe/trunk/test/ASTMerge/interface/Inputs/interface1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/interface/Inputs/interface1.m?rev=322079&r1=322078&r2=322079&view=diff
==============================================================================
--- cfe/trunk/test/ASTMerge/interface/Inputs/interface1.m (original)
+++ cfe/trunk/test/ASTMerge/interface/Inputs/interface1.m Tue Jan 9 06:25:05 2018
@@ -100,4 +100,6 @@
@implementation I15 : I12
@end
-
+ at interface ImportSelectorSLoc { }
+-(int)addInt:(int)a toInt:(int)b moduloInt:(int)c; // don't crash here
+ at end
More information about the cfe-commits
mailing list