From d09810f992a6e80716e5a9b857d205cd814b0731 Mon Sep 17 00:00:00 2001 From: eidheim Date: Mon, 4 Jul 2016 00:40:34 +0200 Subject: [PATCH] Improved Go to Implementation --- src/source_clang.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/source_clang.cc b/src/source_clang.cc index 920630e..8f022a1 100644 --- a/src/source_clang.cc +++ b/src/source_clang.cc @@ -993,6 +993,16 @@ Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file } } } + //If no implementation was found, try using clang_getCursorDefinition + auto definition=clang::Cursor(clang_getCursorDefinition(identifier.cursor.cx_cursor)); + if(definition) { + auto definition_location=definition.get_source_location(); + location.file_path=definition_location.get_path(); + auto offset=definition_location.get_offset(); + location.line=offset.line-1; + location.index=offset.index-1; + return location; + } //If no implementation was found, try using Ctags auto name=identifier.cursor.get_spelling();