diff --git a/src/Cursor.cc b/src/Cursor.cc index 8e03e55..e7651a4 100644 --- a/src/Cursor.cc +++ b/src/Cursor.cc @@ -46,16 +46,31 @@ std::string clangmm::Cursor::get_usr_extended() const { if(!is_valid_kind()) return std::string(); - const auto token_spelling=[](const std::string &spelling) -> std::string { + const auto token_spelling=[](const std::string &spelling_) -> std::string { + std::string spelling; + if(!spelling_.empty() && spelling_[0]=='~') + spelling=spelling_.substr(1); + else + spelling=spelling_; for(size_t i=0;i > clangmm::Tokens::get_similar_token_offsets(Cursor::Kind kind, const std::string &spelling, +std::vector > clangmm::Tokens::get_similar_token_offsets(const std::string &spelling, const std::unordered_set &usrs) { std::vector > offsets; for(auto &token: *this) { if(token.is_identifier()) { auto referenced=token.get_cursor().get_referenced(); - if(referenced && (kind!=Cursor::Kind::CXXMethod || kind==referenced.get_kind()) && spelling==token.get_spelling()) { + if(referenced && spelling==token.get_spelling()) { auto referenced_usrs=referenced.get_all_usr_extended(); for(auto &usr: referenced_usrs) { if(usrs.count(usr)) { diff --git a/src/Tokens.h b/src/Tokens.h index 9a8c7ed..e3fa5b9 100644 --- a/src/Tokens.h +++ b/src/Tokens.h @@ -13,7 +13,7 @@ namespace clangmm { Tokens(CXTranslationUnit &cx_tu, const SourceRange &range); public: ~Tokens(); - std::vector > get_similar_token_offsets(Cursor::Kind kind, const std::string &spelling, + std::vector > get_similar_token_offsets(const std::string &spelling, const std::unordered_set &usrs); private: CXToken *cx_tokens;