@@ -823,14 +823,14 @@ class ObjcMethodReferenceCollector: public SourceEntityWalker {
823823 std::string targetVariant;
824824 SmallVector<StringRef, 32 > FilePaths;
825825 unsigned CurrentFileID;
826- llvm::DenseSet <const clang::ObjCMethodDecl*> results;
826+ llvm::DenseMap <const clang::ObjCMethodDecl*, unsigned > results;
827827 bool visitDeclReference (ValueDecl *D, CharSourceRange Range,
828828 TypeDecl *CtorTyRef, ExtensionDecl *ExtTyRef,
829829 Type T, ReferenceMetaData Data) override {
830830 if (!Range.isValid ())
831831 return true ;
832832 if (auto *clangD = dyn_cast_or_null<clang::ObjCMethodDecl>(D->getClangDecl ())) {
833- results. insert ( clangD) ;
833+ results[ clangD] = CurrentFileID ;
834834 }
835835 return true ;
836836 }
@@ -873,22 +873,23 @@ class ObjcMethodReferenceCollector: public SourceEntityWalker {
873873 if (!targetVariant.empty ())
874874 out.attribute (" target-variant" , targetVariant);
875875 out.attributeArray (" references" , [&] {
876- for (const clang::ObjCMethodDecl* clangD: results) {
876+ for (auto pair: results) {
877+ auto *clangD = pair.first ;
877878 auto &SM = clangD->getASTContext ().getSourceManager ();
878879 clang::SourceLocation Loc = clangD->getLocation ();
879880 if (!Loc.isValid ()) {
880881 continue ;
881882 }
882883 out.object ([&] {
883884 if (auto *parent = dyn_cast_or_null<clang::NamedDecl>(clangD
884- ->getParent ())) {
885+ ->getParent ())) {
885886 auto pName = parent->getName ();
886887 if (!pName.empty ())
887888 out.attribute (selectMethodOwnerKey (parent), pName);
888889 }
889890 out.attribute (selectMethodKey (clangD), clangD->getNameAsString ());
890891 out.attribute (" declared_at" , Loc.printToString (SM));
891- out.attribute (" referenced_at_file_id" , CurrentFileID );
892+ out.attribute (" referenced_at_file_id" , pair. second );
892893 });
893894 }
894895 });
0 commit comments