Lines Matching refs:Tok
26 void TokenLexer::Init(Token &Tok, SourceLocation ELEnd, MacroInfo *MI,
36 ExpandLocStart = Tok.getLocation();
38 AtStartOfLine = Tok.isAtStartOfLine();
39 HasLeadingSpace = Tok.hasLeadingSpace();
52 assert((Tokens[0].getLocation().isFileID() || Tokens[0].is(tok::comment)) &&
147 if (ResultToks.empty() || !ResultToks.back().is(tok::comma))
161 if (!ResultToks.empty() && ResultToks.back().is(tok::hashhash))
185 if (i != 0 && !Tokens[i-1].is(tok::hashhash) && CurTok.hasLeadingSpace())
188 if (CurTok.isOneOf(tok::hash, tok::hashat)) {
198 if (CurTok.is(tok::hash)) // Stringify
225 !ResultToks.empty() && ResultToks.back().is(tok::hashhash);
226 bool PasteBefore = i != 0 && Tokens[i-1].is(tok::hashhash);
227 bool PasteAfter = i+1 != e && Tokens[i+1].is(tok::hashhash);
276 if (ResultArgToks->isNot(tok::eof)) {
286 ResultToks.back().is(tok::comma))
292 Token &Tok = ResultToks[i];
293 if (Tok.is(tok::hashhash))
294 Tok.setKind(tok::unknown);
323 ResultToks[ResultToks.size()-2].is(tok::comma) &&
336 Token &Tok = ResultToks[i];
337 if (Tok.is(tok::hashhash))
338 Tok.setKind(tok::unknown);
379 assert(ResultToks.back().is(tok::hashhash));
412 return FirstTok.is(tok::identifier) &&
419 bool TokenLexer::Lex(Token &Tok) {
426 Tok.startToken();
427 Tok.setFlagValue(Token::StartOfLine , AtStartOfLine);
428 Tok.setFlagValue(Token::LeadingSpace, HasLeadingSpace || NextTokGetsSpace);
430 Tok.setFlag(Token::LeadingEmptyMacro);
431 return PP.HandleEndOfTokenLexer(Tok);
441 Tok = Tokens[CurToken++];
448 (Tokens[CurToken].is(tok::hashhash) ||
453 isWideStringLiteralFromMacro(Tok, Tokens[CurToken])))) {
456 if (PasteTokens(Tok))
469 SM.isBeforeInSLocAddrSpace(Tok.getLocation(), MacroStartSLocOffset)) {
471 if (Tok.is(tok::comment)) {
472 instLoc = SM.createExpansionLoc(Tok.getLocation(),
475 Tok.getLength());
477 instLoc = getExpansionLocForMacroDefLoc(Tok.getLocation());
480 Tok.setLocation(instLoc);
486 Tok.setFlagValue(Token::StartOfLine , AtStartOfLine);
487 Tok.setFlagValue(Token::LeadingSpace, HasLeadingSpace);
491 if (AtStartOfLine) Tok.setFlag(Token::StartOfLine);
492 if (HasLeadingSpace) Tok.setFlag(Token::LeadingSpace);
498 if (!Tok.isAnnotation() && Tok.getIdentifierInfo() != nullptr) {
501 IdentifierInfo *II = Tok.getIdentifierInfo();
502 Tok.setKind(II->getTokenID());
508 PP.HandlePoisonedIdentifier(Tok);
512 return PP.HandleIdentifier(Tok);
519 /// PasteTokens - Tok is the LHS of a ## operator, and CurToken is the ##
521 /// are more ## after it, chomp them iteratively. Return the result as Tok.
523 bool TokenLexer::PasteTokens(Token &Tok) {
528 Tokens[CurToken - 2].is(tok::hashhash))
529 Tok.clearFlag(Token::LeadingSpace);
533 SourceLocation StartLoc = Tok.getLocation();
538 if (Tokens[CurToken].is(tok::hashhash))
547 Buffer.resize(Tok.getLength() + RHS.getLength());
552 unsigned LHSLen = PP.getSpelling(Tok, BufPtr, &Invalid);
576 ResultTokTmp.setKind(tok::string_literal);
584 if (Tok.isAnyIdentifier() && RHS.isAnyIdentifier()) {
589 Result.setKind(tok::raw_identifier);
621 isInvalid |= Result.is(tok::eof);
624 // error. This occurs with "x ## +" and other stuff. Return with Tok
629 if (PP.getLangOpts().MicrosoftExt && Tok.is(tok::slash) &&
630 RHS.is(tok::slash)) {
631 HandleMicrosoftCommentPaste(Tok);
656 if (Result.is(tok::hashhash))
657 Result.setKind(tok::unknown);
661 Result.setFlagValue(Token::StartOfLine , Tok.isAtStartOfLine());
662 Result.setFlagValue(Token::LeadingSpace, Tok.hasLeadingSpace());
666 Tok = Result;
667 } while (!isAtEnd() && Tokens[CurToken].is(tok::hashhash));
687 Tok.setLocation(SM.createExpansionLoc(Tok.getLocation(), StartLoc, EndLoc,
688 Tok.getLength()));
693 if (Tok.is(tok::raw_identifier)) {
696 PP.LookUpIdentifierInfo(Tok);
708 return Tokens[CurToken].is(tok::l_paren);
714 return Tokens[NumTokens-1].is(tok::eod) && !isAtEnd();
722 void TokenLexer::HandleMicrosoftCommentPaste(Token &Tok) {
731 PP.HandleMicrosoftCommentPaste(Tok);
812 Token &Tok = *begin_tokens;
814 SM.isInSameSLocAddrSpace(FirstLoc, Tok.getLocation(), &RelOffs);
815 Tok
836 Token &Tok = *begin_tokens;
837 Tok.setLocation(SM.createMacroArgExpansionLoc(Tok.getLocation(),
839 Tok.getLength()));