154 if (expect_return_type) {
179 if (maybe_inner_function_name)
184 before_inner_function_pos.
Remove();
185 return maybe_inner_function_name;
207 auto maybe_inner_function_ptr_name =
ParseFuncPtr(
false);
208 if (maybe_inner_function_ptr_name)
213 return maybe_inner_function_ptr_name;
408 const auto &token =
Peek();
419 if (token.getKind() == tok::lessless) {
425 if (n_token.getKind() != tok::l_paren && n_token.getKind() != tok::less) {
426 clang::Token tmp_tok;
427 tmp_tok.startToken();
428 tmp_tok.setLength(1);
429 tmp_tok.setLocation(token.getLocation().getLocWithOffset(1));
430 tmp_tok.setKind(tok::less);
440 switch (token.getKind()) {
453#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
457#define OVERLOADED_OPERATOR_MULTI(Name, Spelling, Unary, Binary, MemberOnly)
458#include "clang/Basic/OperatorKinds.def"
459#undef OVERLOADED_OPERATOR
460#undef OVERLOADED_OPERATOR_MULTI
583 State state = State::Beginning;
584 bool continue_parsing =
true;
585 std::optional<size_t> last_coloncolon_position;
588 const auto &token =
Peek();
589 switch (token.getKind()) {
590 case tok::raw_identifier:
591 if (state != State::Beginning && state != State::AfterTwoColons) {
592 continue_parsing =
false;
596 state = State::AfterIdentifier;
598 case tok::l_square: {
606 const bool valid_state =
607 state == State::AfterIdentifier || state == State::AfterOperator;
609 continue_parsing =
false;
615 if (state == State::Beginning || state == State::AfterTwoColons) {
618 state = State::AfterIdentifier;
624 if (state != State::AfterIdentifier && state != State::AfterTemplate &&
625 state != State::AfterOperator) {
626 continue_parsing =
false;
632 continue_parsing =
false;
640 continue_parsing =
false;
643 l_paren_position.
Remove();
644 last_coloncolon_position = coloncolon_position;
645 state = State::AfterTwoColons;
649 if (state == State::Beginning || state == State::AfterTwoColons) {
651 state = State::AfterIdentifier;
655 continue_parsing =
false;
657 case tok::coloncolon:
658 if (state != State::Beginning && state != State::AfterIdentifier &&
659 state != State::AfterTemplate) {
660 continue_parsing =
false;
665 state = State::AfterTwoColons;
668 if (state != State::AfterIdentifier && state != State::AfterOperator) {
669 continue_parsing =
false;
673 continue_parsing =
false;
676 state = State::AfterTemplate;
678 case tok::kw_operator:
679 if (state != State::Beginning && state != State::AfterTwoColons) {
680 continue_parsing =
false;
684 continue_parsing =
false;
687 state = State::AfterOperator;
690 if (state != State::Beginning && state != State::AfterTwoColons) {
691 continue_parsing =
false;
696 state = State::AfterIdentifier;
699 continue_parsing =
false;
703 continue_parsing =
false;
708 if (state == State::AfterIdentifier || state == State::AfterOperator ||
709 state == State::AfterTemplate) {
711 if (last_coloncolon_position) {
729 return llvm::StringRef();
735 clang::SourceLocation start_loc = first_token.getLocation();
736 clang::SourceLocation end_loc = last_token.getLocation();
737 unsigned start_pos = start_loc.getRawEncoding();
738 unsigned end_pos = end_loc.getRawEncoding() + last_token.getLength();
739 return m_text.take_front(end_pos).drop_front(start_pos);
774 for (lexer.LexFromRawLexer(token); !token.is(clang::tok::eof);
775 lexer.LexFromRawLexer(token)) {
776 if (token.is(clang::tok::raw_identifier)) {
777 auto it = kw_map.find(token.getRawIdentifier());
778 if (it != kw_map.end()) {
779 token.setKind(it->getValue());