From d4c2f89fbf5f092e519bda8285511260f8fd74c0 Mon Sep 17 00:00:00 2001 From: eidheim Date: Fri, 11 Aug 2017 10:52:10 +0200 Subject: [PATCH] Minor improvement to Cursor::get_usr_extended() --- src/Cursor.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Cursor.cc b/src/Cursor.cc index e7651a4..a7c22ea 100644 --- a/src/Cursor.cc +++ b/src/Cursor.cc @@ -46,16 +46,16 @@ 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 { - std::string spelling; - if(!spelling_.empty() && spelling_[0]=='~') - spelling=spelling_.substr(1); - else - spelling=spelling_; + const auto token_spelling=[](const std::string &spelling) -> std::string { for(size_t i=0;i0 && spelling[0]=='~') + return spelling.substr(1, i); return spelling.substr(0, i); + } } + if(!spelling.empty() && spelling[0]=='~') + return spelling.substr(1); return spelling; };