@@ -821,7 +821,8 @@ const static unsigned OBJC_METHOD_TRACE_FILE_FORMAT_VERSION = 1;
821
821
class ObjcMethodReferenceCollector : public SourceEntityWalker {
822
822
std::string target;
823
823
std::string targetVariant;
824
- StringRef visitingFilePath;
824
+ SmallVector<StringRef, 32 > FilePaths;
825
+ unsigned CurrentFileID;
825
826
llvm::DenseSet<const clang::ObjCMethodDecl*> results;
826
827
bool visitDeclReference (ValueDecl *D, CharSourceRange Range,
827
828
TypeDecl *CtorTyRef, ExtensionDecl *ExtTyRef,
@@ -859,7 +860,8 @@ class ObjcMethodReferenceCollector: public SourceEntityWalker {
859
860
}
860
861
void setFileBeforeVisiting (SourceFile *SF) {
861
862
assert (SF && " need to visit actual source files" );
862
- visitingFilePath = SF->getFilename ();
863
+ FilePaths.push_back (SF->getFilename ());
864
+ CurrentFileID = FilePaths.size ();
863
865
}
864
866
void serializeAsJson (llvm::raw_ostream &OS) {
865
867
llvm::json::OStream out (OS, /* IndentSize=*/ 4 );
@@ -884,7 +886,15 @@ class ObjcMethodReferenceCollector: public SourceEntityWalker {
884
886
}
885
887
out.attribute (selectMethodKey (clangD), clangD->getNameAsString ());
886
888
out.attribute (" declared_at" , Loc.printToString (SM));
887
- out.attribute (" referenced_at" , visitingFilePath);
889
+ out.attribute (" referenced_at_file_id" , CurrentFileID);
890
+ });
891
+ }
892
+ });
893
+ out.attributeArray (" fileMap" , [&]{
894
+ for (unsigned I = 0 , N = FilePaths.size (); I != N; I ++) {
895
+ out.object ([&] {
896
+ out.attribute (" file_id" , I + 1 );
897
+ out.attribute (" file_path" , FilePaths[I]);
888
898
});
889
899
}
890
900
});
0 commit comments