@@ -823,14 +823,14 @@ class ObjcMethodReferenceCollector: public SourceEntityWalker {
823
823
std::string targetVariant;
824
824
SmallVector<StringRef, 32 > FilePaths;
825
825
unsigned CurrentFileID;
826
- llvm::DenseSet <const clang::ObjCMethodDecl*> results;
826
+ llvm::DenseMap <const clang::ObjCMethodDecl*, unsigned > results;
827
827
bool visitDeclReference (ValueDecl *D, CharSourceRange Range,
828
828
TypeDecl *CtorTyRef, ExtensionDecl *ExtTyRef,
829
829
Type T, ReferenceMetaData Data) override {
830
830
if (!Range.isValid ())
831
831
return true ;
832
832
if (auto *clangD = dyn_cast_or_null<clang::ObjCMethodDecl>(D->getClangDecl ())) {
833
- results. insert ( clangD) ;
833
+ results[ clangD] = CurrentFileID ;
834
834
}
835
835
return true ;
836
836
}
@@ -873,22 +873,23 @@ class ObjcMethodReferenceCollector: public SourceEntityWalker {
873
873
if (!targetVariant.empty ())
874
874
out.attribute (" target-variant" , targetVariant);
875
875
out.attributeArray (" references" , [&] {
876
- for (const clang::ObjCMethodDecl* clangD: results) {
876
+ for (auto pair: results) {
877
+ auto *clangD = pair.first ;
877
878
auto &SM = clangD->getASTContext ().getSourceManager ();
878
879
clang::SourceLocation Loc = clangD->getLocation ();
879
880
if (!Loc.isValid ()) {
880
881
continue ;
881
882
}
882
883
out.object ([&] {
883
884
if (auto *parent = dyn_cast_or_null<clang::NamedDecl>(clangD
884
- ->getParent ())) {
885
+ ->getParent ())) {
885
886
auto pName = parent->getName ();
886
887
if (!pName.empty ())
887
888
out.attribute (selectMethodOwnerKey (parent), pName);
888
889
}
889
890
out.attribute (selectMethodKey (clangD), clangD->getNameAsString ());
890
891
out.attribute (" declared_at" , Loc.printToString (SM));
891
- out.attribute (" referenced_at_file_id" , CurrentFileID );
892
+ out.attribute (" referenced_at_file_id" , pair. second );
892
893
});
893
894
}
894
895
});
0 commit comments