Lines Matching refs:CurPtr

607     const char *CurPtr = Buffer.begin();  in ComputePreamble()  local
609 while (CurPtr != Buffer.end()) { in ComputePreamble()
610 char ch = *CurPtr++; in ComputePreamble()
617 if (CurPtr != Buffer.end()) in ComputePreamble()
618 MaxLineOffset = CurPtr - Buffer.begin(); in ComputePreamble()
1649 bool Lexer::tryConsumeIdentifierUCN(const char *&CurPtr, unsigned Size, in tryConsumeIdentifierUCN() argument
1651 const char *UCNPtr = CurPtr + Size; in tryConsumeIdentifierUCN()
1652 uint32_t CodePoint = tryReadUCN(UCNPtr, CurPtr, /*Token=*/nullptr); in tryConsumeIdentifierUCN()
1664 makeCharRange(*this, CurPtr, UCNPtr), in tryConsumeIdentifierUCN()
1672 makeCharRange(*this, CurPtr, UCNPtr), in tryConsumeIdentifierUCN()
1676 if ((UCNPtr - CurPtr == 6 && CurPtr[1] == 'u') || in tryConsumeIdentifierUCN()
1677 (UCNPtr - CurPtr == 10 && CurPtr[1] == 'U')) in tryConsumeIdentifierUCN()
1678 CurPtr = UCNPtr; in tryConsumeIdentifierUCN()
1680 while (CurPtr != UCNPtr) in tryConsumeIdentifierUCN()
1681 (void)getAndAdvanceChar(CurPtr, Result); in tryConsumeIdentifierUCN()
1685 bool Lexer::tryConsumeIdentifierUTF8Char(const char *&CurPtr) { in tryConsumeIdentifierUTF8Char() argument
1686 const char *UnicodePtr = CurPtr; in tryConsumeIdentifierUTF8Char()
1704 makeCharRange(*this, CurPtr, UnicodePtr), /*IsFirst=*/false); in tryConsumeIdentifierUTF8Char()
1710 makeCharRange(*this, CurPtr, UnicodePtr), in tryConsumeIdentifierUTF8Char()
1713 makeCharRange(*this, CurPtr, UnicodePtr)); in tryConsumeIdentifierUTF8Char()
1716 CurPtr = UnicodePtr; in tryConsumeIdentifierUTF8Char()
1721 const char *CurPtr) { in LexUnicodeIdentifierStart() argument
1726 makeCharRange(*this, BufferPtr, CurPtr), in LexUnicodeIdentifierStart()
1729 makeCharRange(*this, BufferPtr, CurPtr)); in LexUnicodeIdentifierStart()
1733 return LexIdentifierContinue(Result, CurPtr); in LexUnicodeIdentifierStart()
1750 makeCharRange(*this, BufferPtr, CurPtr), /*IsStart*/ true); in LexUnicodeIdentifierStart()
1751 BufferPtr = CurPtr; in LexUnicodeIdentifierStart()
1758 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexUnicodeIdentifierStart()
1762 bool Lexer::LexIdentifierContinue(Token &Result, const char *CurPtr) { in LexIdentifierContinue() argument
1765 unsigned char C = *CurPtr; in LexIdentifierContinue()
1768 ++CurPtr; in LexIdentifierContinue()
1774 C = getCharAndSize(CurPtr, Size); in LexIdentifierContinue()
1776 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexIdentifierContinue()
1785 Diag(CurPtr, diag::ext_dollar_in_identifier); in LexIdentifierContinue()
1786 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexIdentifierContinue()
1789 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) in LexIdentifierContinue()
1791 if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) in LexIdentifierContinue()
1798 FormTokenWithChars(Result, CurPtr, tok::raw_identifier); in LexIdentifierContinue()
1815 if (isCodeCompletionPoint(CurPtr)) { in LexIdentifierContinue()
1823 assert(*CurPtr == 0 && "Completion character must be 0"); in LexIdentifierContinue()
1824 ++CurPtr; in LexIdentifierContinue()
1828 if (CurPtr < BufferEnd) { in LexIdentifierContinue()
1829 while (isAsciiIdentifierContinue(*CurPtr)) in LexIdentifierContinue()
1830 ++CurPtr; in LexIdentifierContinue()
1832 BufferPtr = CurPtr; in LexIdentifierContinue()
1858 bool Lexer::LexNumericConstant(Token &Result, const char *CurPtr) { in LexNumericConstant() argument
1860 char C = getCharAndSize(CurPtr, Size); in LexNumericConstant()
1863 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexNumericConstant()
1865 C = getCharAndSize(CurPtr, Size); in LexNumericConstant()
1873 return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); in LexNumericConstant()
1886 std::find(BufferPtr, CurPtr, '_') != CurPtr) in LexNumericConstant()
1890 return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); in LexNumericConstant()
1896 char Next = getCharAndSizeNoWarn(CurPtr + Size, NextSize, LangOpts); in LexNumericConstant()
1899 Diag(CurPtr, LangOpts.CPlusPlus in LexNumericConstant()
1902 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexNumericConstant()
1903 CurPtr = ConsumeChar(CurPtr, NextSize, Result); in LexNumericConstant()
1904 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
1909 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) in LexNumericConstant()
1910 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
1911 if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) in LexNumericConstant()
1912 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
1916 FormTokenWithChars(Result, CurPtr, tok::numeric_constant); in LexNumericConstant()
1923 const char *Lexer::LexUDSuffix(Token &Result, const char *CurPtr, in LexUDSuffix() argument
1929 char C = getCharAndSize(CurPtr, Size); in LexUDSuffix()
1933 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) in LexUDSuffix()
1935 else if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) in LexUDSuffix()
1938 return CurPtr; in LexUDSuffix()
1943 Diag(CurPtr, in LexUDSuffix()
1946 << FixItHint::CreateInsertion(getSourceLocation(CurPtr), " "); in LexUDSuffix()
1947 return CurPtr; in LexUDSuffix()
1969 char Next = getCharAndSizeNoWarn(CurPtr + Consumed, NextSize, LangOpts); in LexUDSuffix()
1989 Diag(CurPtr, LangOpts.MSVCCompat in LexUDSuffix()
1992 << FixItHint::CreateInsertion(getSourceLocation(CurPtr), " "); in LexUDSuffix()
1993 return CurPtr; in LexUDSuffix()
1996 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexUDSuffix()
2001 C = getCharAndSize(CurPtr, Size); in LexUDSuffix()
2003 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexUDSuffix()
2004 } else if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) { in LexUDSuffix()
2005 } else if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) { in LexUDSuffix()
2010 return CurPtr; in LexUDSuffix()
2015 bool Lexer::LexStringLiteral(Token &Result, const char *CurPtr, in LexStringLiteral() argument
2017 const char *AfterQuote = CurPtr; in LexStringLiteral()
2028 char C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
2033 C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
2036 (C == 0 && CurPtr-1 == BufferEnd)) { // End of file. in LexStringLiteral()
2039 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexStringLiteral()
2044 if (isCodeCompletionPoint(CurPtr-1)) { in LexStringLiteral()
2046 codeCompleteIncludedFile(AfterQuote, CurPtr - 1, /*IsAngled=*/false); in LexStringLiteral()
2049 FormTokenWithChars(Result, CurPtr - 1, tok::unknown); in LexStringLiteral()
2054 NulCharacter = CurPtr-1; in LexStringLiteral()
2056 C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
2061 CurPtr = LexUDSuffix(Result, CurPtr, true); in LexStringLiteral()
2069 FormTokenWithChars(Result, CurPtr, Kind); in LexStringLiteral()
2076 bool Lexer::LexRawStringLiteral(Token &Result, const char *CurPtr, in LexRawStringLiteral() argument
2088 while (PrefixLen != 16 && isRawStringDelimBody(CurPtr[PrefixLen])) in LexRawStringLiteral()
2092 if (CurPtr[PrefixLen] != '(') { in LexRawStringLiteral()
2094 const char *PrefixEnd = &CurPtr[PrefixLen]; in LexRawStringLiteral()
2107 char C = *CurPtr++; in LexRawStringLiteral()
2111 if (C == 0 && CurPtr-1 == BufferEnd) { in LexRawStringLiteral()
2112 --CurPtr; in LexRawStringLiteral()
2117 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexRawStringLiteral()
2122 const char *Prefix = CurPtr; in LexRawStringLiteral()
2123 CurPtr += PrefixLen + 1; // skip over prefix and '(' in LexRawStringLiteral()
2126 char C = *CurPtr++; in LexRawStringLiteral()
2130 if (strncmp(CurPtr, Prefix, PrefixLen) == 0 && CurPtr[PrefixLen] == '"') { in LexRawStringLiteral()
2131 CurPtr += PrefixLen + 1; // skip over prefix and '"' in LexRawStringLiteral()
2134 } else if (C == 0 && CurPtr-1 == BufferEnd) { // End of file. in LexRawStringLiteral()
2138 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexRawStringLiteral()
2145 CurPtr = LexUDSuffix(Result, CurPtr, true); in LexRawStringLiteral()
2149 FormTokenWithChars(Result, CurPtr, Kind); in LexRawStringLiteral()
2156 bool Lexer::LexAngledStringLiteral(Token &Result, const char *CurPtr) { in LexAngledStringLiteral() argument
2159 const char *AfterLessPos = CurPtr; in LexAngledStringLiteral()
2160 char C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2165 C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2168 (C == 0 && (CurPtr - 1 == BufferEnd))) { // End of file. in LexAngledStringLiteral()
2176 if (isCodeCompletionPoint(CurPtr - 1)) { in LexAngledStringLiteral()
2177 codeCompleteIncludedFile(AfterLessPos, CurPtr - 1, /*IsAngled=*/true); in LexAngledStringLiteral()
2179 FormTokenWithChars(Result, CurPtr - 1, tok::unknown); in LexAngledStringLiteral()
2182 NulCharacter = CurPtr-1; in LexAngledStringLiteral()
2184 C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2193 FormTokenWithChars(Result, CurPtr, tok::header_name); in LexAngledStringLiteral()
2233 bool Lexer::LexCharConstant(Token &Result, const char *CurPtr, in LexCharConstant() argument
2247 char C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2251 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexCharConstant()
2258 C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2261 (C == 0 && CurPtr-1 == BufferEnd)) { // End of file. in LexCharConstant()
2264 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexCharConstant()
2269 if (isCodeCompletionPoint(CurPtr-1)) { in LexCharConstant()
2271 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexCharConstant()
2276 NulCharacter = CurPtr-1; in LexCharConstant()
2278 C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2283 CurPtr = LexUDSuffix(Result, CurPtr, false); in LexCharConstant()
2291 FormTokenWithChars(Result, CurPtr, Kind); in LexCharConstant()
2300 bool Lexer::SkipWhitespace(Token &Result, const char *CurPtr, in SkipWhitespace() argument
2303 bool SawNewline = isVerticalWhitespace(CurPtr[-1]); in SkipWhitespace()
2305 unsigned char Char = *CurPtr; in SkipWhitespace()
2314 setLastNewLine(CurPtr - 1); in SkipWhitespace()
2320 Char = *++CurPtr; in SkipWhitespace()
2328 BufferPtr = CurPtr; in SkipWhitespace()
2333 if (*CurPtr == '\n') in SkipWhitespace()
2334 setLastNewLine(CurPtr); in SkipWhitespace()
2336 Char = *++CurPtr; in SkipWhitespace()
2341 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipWhitespace()
2351 char PrevChar = CurPtr[-1]; in SkipWhitespace()
2366 BufferPtr = CurPtr; in SkipWhitespace()
2376 bool Lexer::SkipLineComment(Token &Result, const char *CurPtr, in SkipLineComment() argument
2404 C = *CurPtr; in SkipLineComment()
2408 C = *++CurPtr; in SkipLineComment()
2414 (const llvm::UTF8 *)CurPtr, (const llvm::UTF8 *)BufferEnd); in SkipLineComment()
2417 Diag(CurPtr, diag::warn_invalid_utf8_in_comment); in SkipLineComment()
2419 ++CurPtr; in SkipLineComment()
2422 CurPtr += Length; in SkipLineComment()
2427 const char *NextLine = CurPtr; in SkipLineComment()
2430 const char *EscapePtr = CurPtr-1; in SkipLineComment()
2439 CurPtr = EscapePtr; in SkipLineComment()
2443 CurPtr = EscapePtr-2; in SkipLineComment()
2456 const char *OldPtr = CurPtr; in SkipLineComment()
2459 C = getAndAdvanceChar(CurPtr, Result); in SkipLineComment()
2464 if (C != 0 && CurPtr == OldPtr+1) { in SkipLineComment()
2465 CurPtr = NextLine; in SkipLineComment()
2472 if (CurPtr != OldPtr + 1 && C != '/' && in SkipLineComment()
2473 (CurPtr == BufferEnd + 1 || CurPtr[0] != '/')) { in SkipLineComment()
2474 for (; OldPtr != CurPtr; ++OldPtr) in SkipLineComment()
2479 const char *ForwardPtr = CurPtr; in SkipLineComment()
2492 if (C == '\r' || C == '\n' || CurPtr == BufferEnd + 1) { in SkipLineComment()
2493 --CurPtr; in SkipLineComment()
2497 if (C == '\0' && isCodeCompletionPoint(CurPtr-1)) { in SkipLineComment()
2508 getSourceLocation(CurPtr)))) { in SkipLineComment()
2509 BufferPtr = CurPtr; in SkipLineComment()
2515 return SaveLineComment(Result, CurPtr); in SkipLineComment()
2519 if (ParsingPreprocessorDirective || CurPtr == BufferEnd) { in SkipLineComment()
2520 BufferPtr = CurPtr; in SkipLineComment()
2529 NewLinePtr = CurPtr++; in SkipLineComment()
2536 BufferPtr = CurPtr; in SkipLineComment()
2542 bool Lexer::SaveLineComment(Token &Result, const char *CurPtr) { in SaveLineComment() argument
2545 FormTokenWithChars(Result, CurPtr, tok::comment); in SaveLineComment()
2570 static bool isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr, Lexer *L, in isEndOfBlockCommentWithEscapedNewLine() argument
2572 assert(CurPtr[0] == '\n' || CurPtr[0] == '\r'); in isEndOfBlockCommentWithEscapedNewLine()
2581 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2584 if (CurPtr[0] == '\n' || CurPtr[0] == '\r') { in isEndOfBlockCommentWithEscapedNewLine()
2586 if (CurPtr[0] == CurPtr[1]) in isEndOfBlockCommentWithEscapedNewLine()
2589 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2594 while (isHorizontalWhitespace(*CurPtr) || *CurPtr == 0) { in isEndOfBlockCommentWithEscapedNewLine()
2595 SpacePos = CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2596 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2600 if (*CurPtr == '\\') { in isEndOfBlockCommentWithEscapedNewLine()
2601 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2602 } else if (CurPtr[0] == '/' && CurPtr[-1] == '?' && CurPtr[-2] == '?') { in isEndOfBlockCommentWithEscapedNewLine()
2604 TrigraphPos = CurPtr - 2; in isEndOfBlockCommentWithEscapedNewLine()
2605 CurPtr -= 3; in isEndOfBlockCommentWithEscapedNewLine()
2612 if (*CurPtr == '*') in isEndOfBlockCommentWithEscapedNewLine()
2615 if (*CurPtr != '\n' && *CurPtr != '\r') in isEndOfBlockCommentWithEscapedNewLine()
2633 L->Diag(CurPtr + 1, diag::escaped_newline_block_comment_end); in isEndOfBlockCommentWithEscapedNewLine()
2658 bool Lexer::SkipBlockComment(Token &Result, const char *CurPtr, in SkipBlockComment() argument
2669 unsigned char C = getCharAndSize(CurPtr, CharSize); in SkipBlockComment()
2670 CurPtr += CharSize; in SkipBlockComment()
2671 if (C == 0 && CurPtr == BufferEnd+1) { in SkipBlockComment()
2674 --CurPtr; in SkipBlockComment()
2679 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipBlockComment()
2683 BufferPtr = CurPtr; in SkipBlockComment()
2690 C = *CurPtr++; in SkipBlockComment()
2701 if (CurPtr + 24 < BufferEnd && in SkipBlockComment()
2706 while (C != '/' && (intptr_t)CurPtr % 16 != 0) { in SkipBlockComment()
2709 C = *CurPtr++; in SkipBlockComment()
2715 while (CurPtr + 16 < BufferEnd) { in SkipBlockComment()
2716 int Mask = _mm_movemask_epi8(*(const __m128i *)CurPtr); in SkipBlockComment()
2721 int cmp = _mm_movemask_epi8(_mm_cmpeq_epi8(*(const __m128i*)CurPtr, in SkipBlockComment()
2727 CurPtr += llvm::countTrailingZeros<unsigned>(cmp) + 1; in SkipBlockComment()
2730 CurPtr += 16; in SkipBlockComment()
2740 while (CurPtr + 16 < BufferEnd) { in SkipBlockComment()
2742 vec_any_ge(*(const __vector unsigned char *)CurPtr, LongUTF))) in SkipBlockComment()
2744 if (vec_any_eq(*(const __vector unsigned char *)CurPtr, Slashes)) { in SkipBlockComment()
2747 CurPtr += 16; in SkipBlockComment()
2751 while (CurPtr + 16 < BufferEnd) { in SkipBlockComment()
2754 HasNonASCII |= !isASCII(CurPtr[I]); in SkipBlockComment()
2761 HasSlash |= CurPtr[I] == '/'; in SkipBlockComment()
2764 CurPtr += 16; in SkipBlockComment()
2769 C = *CurPtr++; in SkipBlockComment()
2778 C = *CurPtr++; in SkipBlockComment()
2785 (const llvm::UTF8 *)CurPtr - 1, (const llvm::UTF8 *)BufferEnd); in SkipBlockComment()
2788 Diag(CurPtr - 1, diag::warn_invalid_utf8_in_comment); in SkipBlockComment()
2792 CurPtr += Length - 1; in SkipBlockComment()
2794 C = *CurPtr++; in SkipBlockComment()
2799 if (CurPtr[-2] == '*') // We found the final */. We're done! in SkipBlockComment()
2802 if ((CurPtr[-2] == '\n' || CurPtr[-2] == '\r')) { in SkipBlockComment()
2803 if (isEndOfBlockCommentWithEscapedNewLine(CurPtr - 2, this, in SkipBlockComment()
2810 if (CurPtr[0] == '*' && CurPtr[1] != '/') { in SkipBlockComment()
2815 Diag(CurPtr-1, diag::warn_nested_block_comment); in SkipBlockComment()
2817 } else if (C == 0 && CurPtr == BufferEnd+1) { in SkipBlockComment()
2823 --CurPtr; in SkipBlockComment()
2828 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipBlockComment()
2832 BufferPtr = CurPtr; in SkipBlockComment()
2834 } else if (C == '\0' && isCodeCompletionPoint(CurPtr-1)) { in SkipBlockComment()
2840 C = *CurPtr++; in SkipBlockComment()
2846 getSourceLocation(CurPtr)))) { in SkipBlockComment()
2847 BufferPtr = CurPtr; in SkipBlockComment()
2853 FormTokenWithChars(Result, CurPtr, tok::comment); in SkipBlockComment()
2861 if (isHorizontalWhitespace(*CurPtr)) { in SkipBlockComment()
2862 SkipWhitespace(Result, CurPtr+1, TokAtPhysicalStartOfLine); in SkipBlockComment()
2867 BufferPtr = CurPtr; in SkipBlockComment()
2885 const char *CurPtr = BufferPtr; in ReadToEndOfLine() local
2887 char Char = getAndAdvanceChar(CurPtr, Tmp); in ReadToEndOfLine()
2895 if (CurPtr-1 != BufferEnd) { in ReadToEndOfLine()
2896 if (isCodeCompletionPoint(CurPtr-1)) { in ReadToEndOfLine()
2912 assert(CurPtr[-1] == Char && "Trigraphs for newline?"); in ReadToEndOfLine()
2913 BufferPtr = CurPtr-1; in ReadToEndOfLine()
2934 bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) { in LexEndOfFile() argument
2942 FormTokenWithChars(Result, CurPtr, tok::eod); in LexEndOfFile()
2981 if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')) { in LexEndOfFile()
3003 BufferPtr = CurPtr; in LexEndOfFile()
3054 static const char *FindConflictEnd(const char *CurPtr, const char *BufferEnd, in FindConflictEnd() argument
3058 auto RestOfBuffer = StringRef(CurPtr, BufferEnd - CurPtr).substr(TermLen); in FindConflictEnd()
3077 bool Lexer::IsStartOfConflictMarker(const char *CurPtr) { in IsStartOfConflictMarker() argument
3079 if (CurPtr != BufferStart && in IsStartOfConflictMarker()
3080 CurPtr[-1] != '\n' && CurPtr[-1] != '\r') in IsStartOfConflictMarker()
3084 if (!StringRef(CurPtr, BufferEnd - CurPtr).startswith("<<<<<<<") && in IsStartOfConflictMarker()
3085 !StringRef(CurPtr, BufferEnd - CurPtr).startswith(">>>> ")) in IsStartOfConflictMarker()
3093 ConflictMarkerKind Kind = *CurPtr == '<' ? CMK_Normal : CMK_Perforce; in IsStartOfConflictMarker()
3097 if (FindConflictEnd(CurPtr, BufferEnd, Kind)) { in IsStartOfConflictMarker()
3100 Diag(CurPtr, diag::err_conflict_marker); in IsStartOfConflictMarker()
3105 while (*CurPtr != '\r' && *CurPtr != '\n') { in IsStartOfConflictMarker()
3106 assert(CurPtr != BufferEnd && "Didn't find end of line"); in IsStartOfConflictMarker()
3107 ++CurPtr; in IsStartOfConflictMarker()
3109 BufferPtr = CurPtr; in IsStartOfConflictMarker()
3121 bool Lexer::HandleEndOfConflictMarker(const char *CurPtr) { in HandleEndOfConflictMarker() argument
3123 if (CurPtr != BufferStart && in HandleEndOfConflictMarker()
3124 CurPtr[-1] != '\n' && CurPtr[-1] != '\r') in HandleEndOfConflictMarker()
3134 if (CurPtr[i] != CurPtr[0]) in HandleEndOfConflictMarker()
3140 if (const char *End = FindConflictEnd(CurPtr, BufferEnd, in HandleEndOfConflictMarker()
3142 CurPtr = End; in HandleEndOfConflictMarker()
3145 while (CurPtr != BufferEnd && *CurPtr != '\r' && *CurPtr != '\n') in HandleEndOfConflictMarker()
3146 ++CurPtr; in HandleEndOfConflictMarker()
3148 BufferPtr = CurPtr; in HandleEndOfConflictMarker()
3158 static const char *findPlaceholderEnd(const char *CurPtr, in findPlaceholderEnd() argument
3160 if (CurPtr == BufferEnd) in findPlaceholderEnd()
3163 for (; CurPtr != BufferEnd; ++CurPtr) { in findPlaceholderEnd()
3164 if (CurPtr[0] == '#' && CurPtr[1] == '>') in findPlaceholderEnd()
3165 return CurPtr + 2; in findPlaceholderEnd()
3170 bool Lexer::lexEditorPlaceholder(Token &Result, const char *CurPtr) { in lexEditorPlaceholder() argument
3171 assert(CurPtr[-1] == '<' && CurPtr[0] == '#' && "Not a placeholder!"); in lexEditorPlaceholder()
3174 const char *End = findPlaceholderEnd(CurPtr + 1, BufferEnd); in lexEditorPlaceholder()
3177 const char *Start = CurPtr - 1; in lexEditorPlaceholder()
3189 bool Lexer::isCodeCompletionPoint(const char *CurPtr) const { in isCodeCompletionPoint()
3191 SourceLocation Loc = FileLoc.getLocWithOffset(CurPtr-BufferStart); in isCodeCompletionPoint()
3222 const char *CurPtr = StartPtr + CharSize; in tryReadNumericUCN() local
3223 const char *KindLoc = &CurPtr[-1]; in tryReadNumericUCN()
3227 char C = getCharAndSize(CurPtr, CharSize); in tryReadNumericUCN()
3230 CurPtr += CharSize; in tryReadNumericUCN()
3235 CurPtr += CharSize; in tryReadNumericUCN()
3258 CurPtr += CharSize; in tryReadNumericUCN()
3298 if (CurPtr - StartPtr == (ptrdiff_t)(Count + 2 + (Delimited ? 2 : 0))) in tryReadNumericUCN()
3299 StartPtr = CurPtr; in tryReadNumericUCN()
3301 while (StartPtr != CurPtr) in tryReadNumericUCN()
3304 StartPtr = CurPtr; in tryReadNumericUCN()
3317 const char *CurPtr = StartPtr + CharSize; in tryReadNamedUCN() local
3318 const char *KindLoc = &CurPtr[-1]; in tryReadNamedUCN()
3320 C = getCharAndSize(CurPtr, CharSize); in tryReadNamedUCN()
3326 CurPtr += CharSize; in tryReadNamedUCN()
3327 const char *StartName = CurPtr; in tryReadNamedUCN()
3331 C = getCharAndSize(CurPtr, CharSize); in tryReadNamedUCN()
3332 CurPtr += CharSize; in tryReadNamedUCN()
3363 makeCharRange(*this, StartName, CurPtr - CharSize), in tryReadNamedUCN()
3387 if (CurPtr - StartPtr == (ptrdiff_t)(Buffer.size() + 4)) in tryReadNamedUCN()
3388 StartPtr = CurPtr; in tryReadNamedUCN()
3390 while (StartPtr != CurPtr) in tryReadNamedUCN()
3393 StartPtr = CurPtr; in tryReadNamedUCN()
3462 const char *CurPtr) { in CheckUnicodeWhitespace() argument
3466 << makeCharRange(*this, BufferPtr, CurPtr); in CheckUnicodeWhitespace()
3525 const char *CurPtr = BufferPtr; in LexTokenInternal() local
3528 if (isHorizontalWhitespace(*CurPtr)) { in LexTokenInternal()
3530 ++CurPtr; in LexTokenInternal()
3531 } while (isHorizontalWhitespace(*CurPtr)); in LexTokenInternal()
3537 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexTokenInternal()
3542 BufferPtr = CurPtr; in LexTokenInternal()
3549 char Char = getAndAdvanceChar(CurPtr, Result); in LexTokenInternal()
3558 if (CurPtr-1 == BufferEnd) in LexTokenInternal()
3559 return LexEndOfFile(Result, CurPtr-1); in LexTokenInternal()
3562 if (isCodeCompletionPoint(CurPtr-1)) { in LexTokenInternal()
3565 FormTokenWithChars(Result, CurPtr, tok::code_completion); in LexTokenInternal()
3570 Diag(CurPtr-1, diag::null_in_file); in LexTokenInternal()
3572 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3583 Diag(CurPtr-1, diag::ext_ctrl_z_eof_microsoft); in LexTokenInternal()
3584 return LexEndOfFile(Result, CurPtr-1); in LexTokenInternal()
3592 if (CurPtr[0] == '\n') in LexTokenInternal()
3593 (void)getAndAdvanceChar(CurPtr, Result); in LexTokenInternal()
3609 NewLinePtr = CurPtr - 1; in LexTokenInternal()
3618 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3630 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3634 CurPtr = BufferPtr; in LexTokenInternal()
3638 if (CurPtr[0] == '/' && CurPtr[1] == '/' && !inKeepCommentMode() && in LexTokenInternal()
3640 if (SkipLineComment(Result, CurPtr+2, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3643 } else if (CurPtr[0] == '/' && CurPtr[1] == '*' && !inKeepCommentMode()) { in LexTokenInternal()
3644 if (SkipBlockComment(Result, CurPtr+2, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3647 } else if (isHorizontalWhitespace(*CurPtr)) { in LexTokenInternal()
3660 return LexNumericConstant(Result, CurPtr); in LexTokenInternal()
3670 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3674 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3679 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3684 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3686 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3691 char Char2 = getCharAndSize(CurPtr + SizeTmp, SizeTmp2); in LexTokenInternal()
3696 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3701 Result, ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3707 char Char3 = getCharAndSize(CurPtr + SizeTmp + SizeTmp2, SizeTmp3); in LexTokenInternal()
3711 ConsumeChar(ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3721 return LexIdentifierContinue(Result, CurPtr); in LexTokenInternal()
3728 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3732 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3737 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3742 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3744 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3750 return LexIdentifierContinue(Result, CurPtr); in LexTokenInternal()
3757 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3761 ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3766 return LexIdentifierContinue(Result, CurPtr); in LexTokenInternal()
3771 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3775 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3780 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3782 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3788 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3805 return LexIdentifierContinue(Result, CurPtr); in LexTokenInternal()
3810 Diag(CurPtr-1, diag::ext_dollar_in_identifier); in LexTokenInternal()
3813 return LexIdentifierContinue(Result, CurPtr); in LexTokenInternal()
3823 return LexCharConstant(Result, CurPtr, tok::char_constant); in LexTokenInternal()
3829 return LexStringLiteral(Result, CurPtr, in LexTokenInternal()
3856 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3861 return LexNumericConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result)); in LexTokenInternal()
3864 CurPtr += SizeTmp; in LexTokenInternal()
3866 getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '.') { in LexTokenInternal()
3868 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3875 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3878 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3881 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3887 if (getCharAndSize(CurPtr, SizeTmp) == '=') { in LexTokenInternal()
3889 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3895 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3897 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3900 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3907 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3909 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3912 getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '*') { // C++ ->* in LexTokenInternal()
3913 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3917 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3920 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3930 if (getCharAndSize(CurPtr, SizeTmp) == '=') { in LexTokenInternal()
3932 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3939 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3953 TreatAsComment = getCharAndSize(CurPtr+SizeTmp, SizeTmp2) != '*'; in LexTokenInternal()
3956 if (SkipLineComment(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3968 if (SkipBlockComment(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3978 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3985 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3988 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3991 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3993 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3994 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3995 if (Char == '%' && getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == ':') { in LexTokenInternal()
3997 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4000 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4019 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4021 return LexAngledStringLiteral(Result, CurPtr); in LexTokenInternal()
4023 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
4026 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4028 } else if (After == '<' && IsStartOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
4032 } else if (After == '<' && HandleEndOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
4038 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4041 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4045 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
4050 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4060 getSourceLocation(CurPtr + SizeTmp, SizeTmp2), " "); in LexTokenInternal()
4063 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4067 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == ':') { in LexTokenInternal()
4074 char After = getCharAndSize(CurPtr + SizeTmp + SizeTmp2, SizeTmp3); in LexTokenInternal()
4083 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4086 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4089 lexEditorPlaceholder(Result, CurPtr)) { in LexTokenInternal()
4096 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4098 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4101 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
4103 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4106 } else if (After == '>' && IsStartOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
4110 } else if (After == '>' && HandleEndOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
4115 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4118 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4126 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4128 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4131 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4138 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4141 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4144 if (CurPtr[1] == '|' && HandleEndOfConflictMarker(CurPtr-1)) in LexTokenInternal()
4147 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4153 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4156 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4161 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4170 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4173 if (CurPtr[1] == '=' && HandleEndOfConflictMarker(CurPtr-1)) in LexTokenInternal()
4177 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4186 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4189 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4194 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4209 if (CurPtr[-1] == '@' && LangOpts.ObjC) in LexTokenInternal()
4218 if (uint32_t CodePoint = tryReadUCN(CurPtr, BufferPtr, &Result)) { in LexTokenInternal()
4219 if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) { in LexTokenInternal()
4220 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
4228 return LexUnicodeIdentifierStart(Result, CodePoint, CurPtr); in LexTokenInternal()
4245 --CurPtr; in LexTokenInternal()
4247 llvm::convertUTF8Sequence((const llvm::UTF8 **)&CurPtr, in LexTokenInternal()
4252 if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) { in LexTokenInternal()
4253 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
4260 return LexUnicodeIdentifierStart(Result, CodePoint, CurPtr); in LexTokenInternal()
4265 ++CurPtr; in LexTokenInternal()
4273 Diag(CurPtr, diag::err_invalid_utf8); in LexTokenInternal()
4275 BufferPtr = CurPtr+1; in LexTokenInternal()
4287 FormTokenWithChars(Result, CurPtr, Kind); in LexTokenInternal()
4293 FormTokenWithChars(Result, CurPtr, tok::hash); in LexTokenInternal()