Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ bool CPlusPlusNameParser::ConsumeAbiTag() {

// Consume the actual tag string (and allow some special characters)
while (ConsumeToken(tok::raw_identifier, tok::comma, tok::period,
tok::numeric_constant))
tok::numeric_constant, tok::kw_operator))
;

if (!ConsumeToken(tok::r_square))
Expand Down Expand Up @@ -420,10 +420,11 @@ bool CPlusPlusNameParser::ConsumeOperator() {
// Make sure we have more tokens before attempting to look ahead one more.
if (m_next_token_index + 1 < m_tokens.size()) {
// Look ahead two tokens.
clang::Token n_token = m_tokens[m_next_token_index + 1];
// If we find ( or < then this is indeed operator<< no need for fix.
if (n_token.getKind() != tok::l_paren && n_token.getKind() != tok::less) {
clang::Token tmp_tok;
const clang::Token n_token = m_tokens[m_next_token_index + 1];
// If we find `(`, `<` or `[` then this is indeed operator<< no need for
// fix.
if (!n_token.isOneOf(tok::l_paren, tok::less, tok::l_square)) {
clang::Token tmp_tok{};
tmp_tok.startToken();
tmp_tok.setLength(1);
tmp_tok.setLocation(token.getLocation().getLocWithOffset(1));
Expand Down
6 changes: 6 additions & 0 deletions lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ TEST(CPlusPlusLanguage, MethodNameParsing) {
"const",
"std::__1::ranges::__begin::__fn::operator()[abi:v160000]<char const, "
"18ul>"},
{"bool Ball[abi:BALL]<int>::operator<<[abi:operator]<int>(int)", "bool",
"Ball[abi:BALL]<int>", "operator<<[abi:operator]<int>", "(int)", "",
"Ball[abi:BALL]<int>::operator<<[abi:operator]<int>"},
{"bool Ball[abi:BALL]<int>::operator>>[abi:operator]<int>(int)", "bool",
"Ball[abi:BALL]<int>", "operator>>[abi:operator]<int>", "(int)", "",
"Ball[abi:BALL]<int>::operator>>[abi:operator]<int>"},
// Internal classes
{"operator<<(Cls, Cls)::Subclass::function()", "",
"operator<<(Cls, Cls)::Subclass", "function", "()", "",
Expand Down
Loading