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) {
426 if (!n_token.isOneOf(tok::l_paren, tok::less, tok::l_square)) {
427 clang::Token tmp_tok{};
428 tmp_tok.startToken();
429 tmp_tok.setLength(1);
430 tmp_tok.setLocation(token.getLocation().getLocWithOffset(1));
431 tmp_tok.setKind(tok::less);
441 switch (token.getKind()) {
454#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
458#define OVERLOADED_OPERATOR_MULTI(Name, Spelling, Unary, Binary, MemberOnly)
459#include "clang/Basic/OperatorKinds.def"
460#undef OVERLOADED_OPERATOR
461#undef OVERLOADED_OPERATOR_MULTI
584 State state = State::Beginning;
585 bool continue_parsing =
true;
586 std::optional<size_t> last_coloncolon_position;
589 const auto &token =
Peek();
590 switch (token.getKind()) {
591 case tok::raw_identifier:
592 if (state != State::Beginning && state != State::AfterTwoColons) {
593 continue_parsing =
false;
597 state = State::AfterIdentifier;
599 case tok::l_square: {
607 const bool valid_state =
608 state == State::AfterIdentifier || state == State::AfterOperator;
610 continue_parsing =
false;
616 if (state == State::Beginning || state == State::AfterTwoColons) {
619 state = State::AfterIdentifier;
625 if (state != State::AfterIdentifier && state != State::AfterTemplate &&
626 state != State::AfterOperator) {
627 continue_parsing =
false;
633 continue_parsing =
false;
641 continue_parsing =
false;
644 l_paren_position.
Remove();
645 last_coloncolon_position = coloncolon_position;
646 state = State::AfterTwoColons;
650 if (state == State::Beginning || state == State::AfterTwoColons) {
652 state = State::AfterIdentifier;
656 continue_parsing =
false;
658 case tok::coloncolon:
659 if (state != State::Beginning && state != State::AfterIdentifier &&
660 state != State::AfterTemplate) {
661 continue_parsing =
false;
666 state = State::AfterTwoColons;
669 if (state != State::AfterIdentifier && state != State::AfterOperator) {
670 continue_parsing =
false;
674 continue_parsing =
false;
677 state = State::AfterTemplate;
679 case tok::kw_operator:
680 if (state != State::Beginning && state != State::AfterTwoColons) {
681 continue_parsing =
false;
685 continue_parsing =
false;
688 state = State::AfterOperator;
691 if (state != State::Beginning && state != State::AfterTwoColons) {
692 continue_parsing =
false;
697 state = State::AfterIdentifier;
700 continue_parsing =
false;
704 continue_parsing =
false;
709 if (state == State::AfterIdentifier || state == State::AfterOperator ||
710 state == State::AfterTemplate) {
712 if (last_coloncolon_position) {
730 return llvm::StringRef();
736 clang::SourceLocation start_loc = first_token.getLocation();
737 clang::SourceLocation end_loc = last_token.getLocation();
738 unsigned start_pos = start_loc.getRawEncoding();
739 unsigned end_pos = end_loc.getRawEncoding() + last_token.getLength();
740 return m_text.take_front(end_pos).drop_front(start_pos);
775 for (lexer.LexFromRawLexer(token); !token.is(clang::tok::eof);
776 lexer.LexFromRawLexer(token)) {
777 if (token.is(clang::tok::raw_identifier)) {
778 auto it = kw_map.find(token.getRawIdentifier());
779 if (it != kw_map.end()) {
780 token.setKind(it->getValue());