| 54 | //----------------------------------------------------------------------------- |
| 55 | |
| 56 | std::string ScopeHandler::RemoveCurrentScope(std::string name) |
| 57 | { |
| 58 | if(mScope.length()) { |
| 59 | auto findAndReplace = [&name](const std::string& scope) { |
| 60 | if(const auto startPos = name.find(scope, 0); std::string::npos != startPos) { |
| 61 | if(const auto pos = startPos + scope.length(); |
| 62 | (pos > name.length()) or (name[pos] != '*')) { // keep member points (See #374) |
| 63 | name.replace(startPos, scope.length(), ""sv); |
| 64 | return true; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | return false; |
| 69 | }; |
| 70 | |
| 71 | // The default is that we can replace the entire scope. Suppose we are currently in N::X and having a symbol |
| 72 | // N::X::y then N::X:: is removed. |
| 73 | if(not findAndReplace(mScope)) { |
| 74 | |
| 75 | // A special case where we need to remove the scope without the last item. |
| 76 | std::string tmp{mScope}; |
| 77 | tmp.resize(mGlobalStack.back().mLength); |
| 78 | |
| 79 | findAndReplace(tmp); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | return name; |
| 84 | } |
| 85 | //----------------------------------------------------------------------------- |
| 86 | |
| 87 | static std::string GetNamePlain(const NamedDecl& decl) |
nothing calls this directly
no outgoing calls
no test coverage detected