[PATCH] D6550: ASTImporter: Fix missing SourceLoc imports

Aleksei Sidorin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 18 09:10:50 PST 2017


a.sidorin updated this revision to Diff 127375.
a.sidorin added reviewers: xazax.hun, szepet.
a.sidorin added a comment.
Herald added a subscriber: rnkovacs.

Removed already fixed stuff, added a test for remaining.


Repository:
  rC Clang

https://reviews.llvm.org/D6550

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


Index: test/ASTMerge/interface/Inputs/interface1.m
===================================================================
--- test/ASTMerge/interface/Inputs/interface1.m
+++ test/ASTMerge/interface/Inputs/interface1.m
@@ -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
Index: lib/AST/ASTImporter.cpp
===================================================================
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -2857,9 +2857,13 @@
     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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6550.127375.patch
Type: text/x-patch
Size: 1045 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171218/f2f899f1/attachment.bin>


More information about the cfe-commits mailing list