From 8d83d9c69b2e0a25db7117dc5ca0a9f2bd604359 Mon Sep 17 00:00:00 2001 From: eidheim Date: Thu, 31 Mar 2016 21:46:53 +0200 Subject: [PATCH] Fixes to last commit --- src/Cursor.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Cursor.cc b/src/Cursor.cc index 04a6e92..97a9174 100644 --- a/src/Cursor.cc +++ b/src/Cursor.cc @@ -55,9 +55,8 @@ std::string clang::Cursor::get_type() { if(spelling.size()>=4 && std::equal(auto_str.begin(), auto_str.end(), spelling.begin())) { auto canonical_type=clang_getCanonicalType(clang_getCursorType(cx_cursor)); auto canonical_spelling=clang::to_string(clang_getTypeSpelling(canonical_type)); - if(spelling.size()>4 && spelling[4]==' ' && - !std::equal(auto_str.begin(), auto_str.end(), canonical_spelling.begin())) - return canonical_spelling+spelling.substr(4); + if(spelling.size()>5 && spelling[4]==' ' && spelling[5]=='&' && spelling!=canonical_spelling) + return canonical_spelling+" &"; else return canonical_spelling; } @@ -66,9 +65,8 @@ std::string clang::Cursor::get_type() { if(spelling.size()>=10 && std::equal(const_auto_str.begin(), const_auto_str.end(), spelling.begin())) { auto canonical_type=clang_getCanonicalType(clang_getCursorType(cx_cursor)); auto canonical_spelling=clang::to_string(clang_getTypeSpelling(canonical_type)); - if(spelling.size()>10 && spelling[10]==' ' && - !std::equal(const_auto_str.begin(), const_auto_str.end(), canonical_spelling.begin())) - return canonical_spelling+spelling.substr(10); + if(spelling.size()>11 && spelling[10]==' ' && spelling[11]=='&' && spelling!=canonical_spelling) + return canonical_spelling+" &"; else return canonical_spelling; }