From 4b9bc342f5b76c4694816d324524b96de6f7726a Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 24 Dec 2017 10:43:32 -0800 Subject: [PATCH] Fix called_id --- src/indexer.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/indexer.cc b/src/indexer.cc index e4d47c1e..2d6fc9f5 100644 --- a/src/indexer.cc +++ b/src/indexer.cc @@ -416,6 +416,7 @@ bool IsFunctionCallContext(CXCursorKind kind) { void OnIndexReference_Function(IndexFile* db, Range loc_spelling, ClangCursor caller_cursor, + IndexFuncId called_id, IndexFunc* called, const std::string& called_usr, bool is_implicit) { @@ -423,6 +424,7 @@ void OnIndexReference_Function(IndexFile* db, IndexFuncId caller_id = db->ToFuncId(caller_cursor.cx_cursor); IndexFunc* caller = db->Resolve(caller_id); // Calling db->ToFuncId invalidates the FuncDef* ptrs. + called = db->Resolve(called_id); AddFuncRef(&caller->def.callees, IndexFuncRef(called->id, loc_spelling, is_implicit)); @@ -1056,6 +1058,7 @@ ClangCursor::VisitResult TemplateVisitor(ClangCursor cursor, OnIndexReference_Function(data->db, ResolveSpelling(cursor.cx_cursor), data->container, + called_id, called, ref_usr, /*implicit=*/ false); @@ -1642,6 +1645,7 @@ void OnIndexReference(CXClientData client_data, const CXIdxEntityRefInfo* ref) { OnIndexReference_Function(db, loc_spelling, ref->container->cursor, + called_id, called, ref->referencedEntity->USR, is_implicit);