Lines Matching refs:Result
203 std::string Result = Str;
205 for (unsigned i = 0, e = Result.size(); i != e; ++i) {
206 if (Result[i] == '\\' || Result[i] == Quote) {
207 Result.insert(Result.begin()+i, '\\');
211 return Result;
342 std::string Result;
343 Result.resize(Tok.getLength());
344 Result.resize(getSpellingSlow(Tok, TokStart, LangOpts, &*Result.begin()));
345 return Result;
417 bool Lexer::getRawToken(SourceLocation Loc, Token &Result,
445 TheLexer.LexFromRawLexer(Result);
1089 /// return the result character. Finally, emit a warning about trigraph use
1433 Token &Result) {
1444 Result.setFlag(Token::HasUCN);
1450 (void)getAndAdvanceChar(CurPtr, Result);
1457 ConversionResult Result =
1462 if (Result != conversionOK ||
1475 bool Lexer::LexIdentifier(Token &Result, const char *CurPtr) {
1493 FormTokenWithChars(Result, CurPtr, tok::raw_identifier);
1494 Result.setRawIdentifierData(IdStart);
1501 // Fill in Result.IdentifierInfo and update the token kind,
1503 IdentifierInfo *II = PP->LookUpIdentifierInfo(Result);
1508 return PP->HandleIdentifier(Result);
1524 CurPtr = ConsumeChar(CurPtr, Size, Result);
1528 } else if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) {
1539 CurPtr = ConsumeChar(CurPtr, Size, Result);
1543 CurPtr = ConsumeChar(CurPtr, Size, Result);
1563 bool Lexer::LexNumericConstant(Token &Result, const char *CurPtr) {
1568 CurPtr = ConsumeChar(CurPtr, Size, Result);
1578 return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result));
1594 return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result));
1604 CurPtr = ConsumeChar(CurPtr, Size, Result);
1605 CurPtr = ConsumeChar(CurPtr, NextSize, Result);
1606 return LexNumericConstant(Result, CurPtr);
1611 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result))
1612 return LexNumericConstant(Result, CurPtr);
1614 return LexNumericConstant(Result, CurPtr);
1618 FormTokenWithChars(Result, CurPtr, tok::numeric_constant);
1619 Result.setLiteralData(TokStart);
1625 const char *Lexer::LexUDSuffix(Token &Result, const char *CurPtr,
1635 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result))
1699 CurPtr = ConsumeChar(CurPtr, Size, Result);
1702 Result.setFlag(Token::HasUDSuffix);
1705 if (isIdentifierBody(C)) { CurPtr = ConsumeChar(CurPtr, Size, Result); }
1706 else if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) {}
1716 bool Lexer::LexStringLiteral(Token &Result, const char *CurPtr,
1729 char C = getAndAdvanceChar(CurPtr, Result);
1734 C = getAndAdvanceChar(CurPtr, Result);
1740 FormTokenWithChars(Result, CurPtr-1, tok::unknown);
1747 FormTokenWithChars(Result, CurPtr-1, tok::unknown);
1754 C = getAndAdvanceChar(CurPtr, Result);
1759 CurPtr = LexUDSuffix(Result, CurPtr, true);
1767 Result, CurPtr, Kind);
1768 Result.setLiteralData(TokStart);
1774 bool Lexer::LexRawStringLiteral(Token &Result, const char *CurPtr,
1815 FormTokenWithChars(Result, CurPtr, tok::unknown);
1836 FormTokenWithChars(Result, CurPtr-1, tok::unknown);
1843 CurPtr = LexUDSuffix(Result, CurPtr, true);
1847 FormTokenWithChars(Result, CurPtr, Kind);
1848 Result.setLiteralData(TokStart);
1854 bool Lexer::LexAngledStringLiteral(Token &Result, const char *CurPtr) {
1858 char C = getAndAdvanceChar(CurPtr, Result);
1863 getAndAdvanceChar(CurPtr, Result);
1869 FormTokenWithChars(Result, AfterLessPos, tok::less);
1874 C = getAndAdvanceChar(CurPtr, Result);
1883 FormTokenWithChars(Result, CurPtr, tok::angle_string_literal);
1884 Result.setLiteralData(TokStart);
1891 bool Lexer::LexCharConstant(Token &Result, const char *CurPtr,
1905 char C = getAndAdvanceChar(CurPtr, Result);
1909 FormTokenWithChars(Result, CurPtr, tok::unknown);
1916 C = getAndAdvanceChar(CurPtr, Result);
1922 FormTokenWithChars(Result, CurPtr-1, tok::unknown);
1929 FormTokenWithChars(Result, CurPtr-1, tok::unknown);
1936 C = getAndAdvanceChar(CurPtr, Result);
1941 CurPtr = LexUDSuffix(Result, CurPtr, false);
1949 FormTokenWithChars(Result, CurPtr, Kind);
1950 Result.setLiteralData(TokStart);
1959 bool Lexer::SkipWhitespace(Token &Result, const char *CurPtr,
1989 FormTokenWithChars(Result, CurPtr, tok::unknown);
2002 Result.setFlagValue(Token::LeadingSpace, HasLeadingSpace);
2004 Result.setFlag(Token::StartOfLine);
2018 bool Lexer::SkipLineComment(Token &Result, const char *CurPtr,
2071 C = getAndAdvanceChar(CurPtr, Result);
2119 PP->HandleComment(Result, SourceRange(getSourceLocation(BufferPtr),
2127 return SaveLineComment(Result, CurPtr);
2144 Result.setFlag(Token::StartOfLine);
2147 Result.clearFlag(Token::LeadingSpace);
2154 bool Lexer::SaveLineComment(Token &Result, const char *CurPtr) {
2157 FormTokenWithChars(Result, CurPtr, tok::comment);
2165 std::string Spelling = PP->getSpelling(Result, &Invalid);
2173 Result.setKind(tok::comment);
2174 PP->CreateString(Spelling, Result,
2175 Result.getLocation(), Result.getLocation());
2256 bool Lexer::SkipBlockComment(Token &Result, const char *CurPtr,
2277 FormTokenWithChars(Result, CurPtr, tok::unknown);
2374 FormTokenWithChars(Result, CurPtr, tok::unknown);
2391 PP->HandleComment(Result, SourceRange(getSourceLocation(BufferPtr),
2399 FormTokenWithChars(Result, CurPtr, tok::comment);
2408 SkipWhitespace(Result, CurPtr+1, TokAtPhysicalStartOfLine);
2414 Result.setFlag(Token::LeadingSpace);
2424 void Lexer::ReadToEndOfLine(SmallVectorImpl<char> *Result) {
2435 if (Result)
2436 Result->push_back(Char);
2448 if (Result)
2449 Result->push_back(Char);
2476 /// This returns true if Result contains a token, false if PP.Lex should be
2478 bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) {
2486 FormTokenWithChars(Result, CurPtr, tok::eod);
2497 Result.startToken();
2499 FormTokenWithChars(Result, BufferEnd, tok::eof);
2540 return PP->HandleEndOfFile(Result, isPragmaLexer());
2696 Token *Result) {
2709 if (Result && !isLexingRawMode())
2723 if (Result && !isLexingRawMode()) {
2748 if (Result) {
2749 Result->setFlag(Token::HasUCN);
2754 (void)getAndAdvanceChar(StartPtr, *Result);
2780 if (Result && PP) {
2795 if (Result && PP) {
2807 bool Lexer::CheckUnicodeWhitespace(Token &Result, uint32_t C,
2816 Result.setFlag(Token::LeadingSpace);
2822 bool Lexer::LexUnicode(Token &Result, uint32_t C, const char *CurPtr) {
2832 return LexIdentifier(Result, CurPtr);
2857 FormTokenWithChars(Result, CurPtr, tok::unknown);
2861 void Lexer::PropagateLineStartLeadingSpaceInfo(Token &Result) {
2862 IsAtStartOfLine = Result.isAtStartOfLine();
2863 HasLeadingSpace = Result.hasLeadingSpace();
2864 HasLeadingEmptyMacro = Result.hasLeadingEmptyMacro();
2868 bool Lexer::Lex(Token &Result) {
2870 Result.startToken();
2874 Result.setFlag(Token::StartOfLine);
2879 Result.setFlag(Token::LeadingSpace);
2884 Result.setFlag(Token::LeadingEmptyMacro);
2892 bool returnedToken = LexTokenInternal(Result, atPhysicalStartOfLine);
2902 /// that the Flags of result have been cleared before calling this.
2903 bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
2906 Result.clearFlag(Token::NeedsCleaning);
2907 Result.setIdentifierInfo(nullptr);
2922 FormTokenWithChars(Result, CurPtr, tok::unknown);
2928 Result.setFlag(Token::LeadingSpace);
2934 char Char = getAndAdvanceChar(CurPtr, Result);
2941 return LexEndOfFile(Result, CurPtr-1);
2946 Result.startToken();
2947 FormTokenWithChars(Result, CurPtr, tok::code_completion);
2953 Result.setFlag(Token::LeadingSpace);
2954 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine))
2964 return LexEndOfFile(Result, CurPtr-1);
2991 Result.clearFlag(Token::LeadingSpace);
2993 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine))
3004 Result.setFlag(Token::LeadingSpace);
3005 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine))
3016 if (SkipLineComment(Result, CurPtr+2, TokAtPhysicalStartOfLine))
3020 if (SkipBlockComment(Result, CurPtr+2, TokAtPhysicalStartOfLine))
3036 return LexNumericConstant(Result, CurPtr);
3047 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result),
3052 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result),
3058 return LexRawStringLiteral(Result,
3059 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
3060 SizeTmp2, Result),
3068 return LexStringLiteral(Result,
3069 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
3070 SizeTmp2, Result),
3074 Result, ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
3075 SizeTmp2, Result),
3083 return LexRawStringLiteral(Result,
3084 ConsumeChar(ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
3085 SizeTmp2, Result),
3086 SizeTmp3, Result),
3094 return LexIdentifier(Result, CurPtr);
3105 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result),
3110 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result),
3116 return LexRawStringLiteral(Result,
3117 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
3118 SizeTmp2, Result),
3123 return LexIdentifier(Result, CurPtr);
3133 return LexRawStringLiteral(Result,
3134 ConsumeChar(CurPtr, SizeTmp, Result),
3139 return LexIdentifier(Result, CurPtr);
3148 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result),
3154 Result,
3155 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
3156 SizeTmp2, Result),
3161 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result),
3177 return LexIdentifier(Result, CurPtr);
3185 return LexIdentifier(Result, CurPtr);
3195 return LexCharConstant(Result, CurPtr, tok::char_constant);
3201 return LexStringLiteral(Result, CurPtr, tok::string_literal);
3231 return LexNumericConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result));
3238 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
3239 SizeTmp2, Result);
3248 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3251 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3259 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3267 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3270 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3279 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3283 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
3284 SizeTmp2, Result);
3287 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3290 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3302 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3326 if (SkipLineComment(Result, ConsumeChar(CurPtr, SizeTmp, Result),
3338 if (SkipBlockComment(Result, ConsumeChar(CurPtr, SizeTmp, Result),
3348 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3358 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3361 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3363 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3367 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
3368 SizeTmp2, Result);
3370 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3391 return LexAngledStringLiteral(Result, CurPtr);
3396 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
3397 SizeTmp2, Result);
3408 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
3409 SizeTmp2, Result);
3411 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3415 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3435 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3438 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3447 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3452 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
3453 SizeTmp2, Result);
3464 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
3465 SizeTmp2, Result);
3467 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3478 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3488 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3494 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3503 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3506 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3522 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3534 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3539 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
3562 if (uint32_t CodePoint = tryReadUCN(CurPtr, BufferPtr, &Result)) {
3563 if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) {
3564 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine))
3572 return LexUnicode(Result, CodePoint, CurPtr);
3595 if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) {
3596 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine))
3603 return LexUnicode(Result, CodePoint, CurPtr);
3630 FormTokenWithChars(Result, CurPtr, Kind);
3636 FormTokenWithChars(Result, CurPtr, tok::hash);
3637 PP->HandleDirective(Result);
3641 assert(Result.is(tok::eof) && "Preprocessor did not set tok:eof");