[PATCH] D6550: ASTImporter: Fix missing SourceLoc imports

Aleksei Sidorin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 9 06:26:23 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC322079: [ASTImporter] Fix missing SourceLoc import for ObjCMethodDecl selectors (authored by a.sidorin, committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D6550

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


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);
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


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


More information about the cfe-commits mailing list