Lines Matching refs:CurPtr

655     const char *CurPtr = Buffer.begin();  in ComputePreamble()  local
657 while (CurPtr != Buffer.end()) { in ComputePreamble()
658 char ch = *CurPtr++; in ComputePreamble()
665 if (CurPtr != Buffer.end()) in ComputePreamble()
666 MaxLineOffset = CurPtr - Buffer.begin(); in ComputePreamble()
1766 bool Lexer::tryConsumeIdentifierUCN(const char *&CurPtr, unsigned Size, in tryConsumeIdentifierUCN() argument
1768 const char *UCNPtr = CurPtr + Size; in tryConsumeIdentifierUCN()
1769 uint32_t CodePoint = tryReadUCN(UCNPtr, CurPtr, /*Token=*/nullptr); in tryConsumeIdentifierUCN()
1781 makeCharRange(*this, CurPtr, UCNPtr), in tryConsumeIdentifierUCN()
1790 makeCharRange(*this, CurPtr, UCNPtr)); in tryConsumeIdentifierUCN()
1793 makeCharRange(*this, CurPtr, UCNPtr), in tryConsumeIdentifierUCN()
1798 if ((UCNPtr - CurPtr == 6 && CurPtr[1] == 'u') || in tryConsumeIdentifierUCN()
1799 (UCNPtr - CurPtr == 10 && CurPtr[1] == 'U')) in tryConsumeIdentifierUCN()
1800 CurPtr = UCNPtr; in tryConsumeIdentifierUCN()
1802 while (CurPtr != UCNPtr) in tryConsumeIdentifierUCN()
1803 (void)getAndAdvanceChar(CurPtr, Result); in tryConsumeIdentifierUCN()
1807 bool Lexer::tryConsumeIdentifierUTF8Char(const char *&CurPtr, Token &Result) { in tryConsumeIdentifierUTF8Char() argument
1814 getCharAndSize(CurPtr, FirstCodeUnitSize); in tryConsumeIdentifierUTF8Char()
1815 const char *CharStart = CurPtr + FirstCodeUnitSize - 1; in tryConsumeIdentifierUTF8Char()
1853 ConsumeChar(CurPtr, FirstCodeUnitSize, Result); in tryConsumeIdentifierUTF8Char()
1854 CurPtr = UnicodePtr; in tryConsumeIdentifierUTF8Char()
1859 const char *CurPtr) { in LexUnicodeIdentifierStart() argument
1866 makeCharRange(*this, BufferPtr, CurPtr)); in LexUnicodeIdentifierStart()
1868 makeCharRange(*this, BufferPtr, CurPtr), in LexUnicodeIdentifierStart()
1871 makeCharRange(*this, BufferPtr, CurPtr)); in LexUnicodeIdentifierStart()
1875 return LexIdentifierContinue(Result, CurPtr); in LexUnicodeIdentifierStart()
1892 makeCharRange(*this, BufferPtr, CurPtr), /*IsStart*/ true); in LexUnicodeIdentifierStart()
1893 BufferPtr = CurPtr; in LexUnicodeIdentifierStart()
1900 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexUnicodeIdentifierStart()
1905 fastParseASCIIIdentifier(const char *CurPtr, in fastParseASCIIIdentifier() argument
1916 while (LLVM_LIKELY(BufferEnd - CurPtr >= BytesPerRegister)) { in fastParseASCIIIdentifier()
1917 __m128i Cv = _mm_loadu_si128((const __m128i *)(CurPtr)); in fastParseASCIIIdentifier()
1922 CurPtr += Consumed; in fastParseASCIIIdentifier()
1925 return CurPtr; in fastParseASCIIIdentifier()
1929 unsigned char C = *CurPtr; in fastParseASCIIIdentifier()
1931 C = *++CurPtr; in fastParseASCIIIdentifier()
1932 return CurPtr; in fastParseASCIIIdentifier()
1935 bool Lexer::LexIdentifierContinue(Token &Result, const char *CurPtr) { in LexIdentifierContinue() argument
1940 CurPtr = fastParseASCIIIdentifier(CurPtr, BufferEnd); in LexIdentifierContinue()
1944 unsigned char C = getCharAndSize(CurPtr, Size); in LexIdentifierContinue()
1946 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexIdentifierContinue()
1955 Diag(CurPtr, diag::ext_dollar_in_identifier); in LexIdentifierContinue()
1956 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexIdentifierContinue()
1959 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) in LexIdentifierContinue()
1961 if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr, Result)) in LexIdentifierContinue()
1968 FormTokenWithChars(Result, CurPtr, tok::raw_identifier); in LexIdentifierContinue()
1985 if (isCodeCompletionPoint(CurPtr)) { in LexIdentifierContinue()
1993 assert(*CurPtr == 0 && "Completion character must be 0"); in LexIdentifierContinue()
1994 ++CurPtr; in LexIdentifierContinue()
1998 if (CurPtr < BufferEnd) { in LexIdentifierContinue()
1999 while (isAsciiIdentifierContinue(*CurPtr)) in LexIdentifierContinue()
2000 ++CurPtr; in LexIdentifierContinue()
2002 BufferPtr = CurPtr; in LexIdentifierContinue()
2031 bool Lexer::LexNumericConstant(Token &Result, const char *CurPtr) { in LexNumericConstant() argument
2033 char C = getCharAndSize(CurPtr, Size); in LexNumericConstant()
2036 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexNumericConstant()
2038 if (LangOpts.HLSL && C == '.' && (*CurPtr == 'x' || *CurPtr == 'r')) { in LexNumericConstant()
2039 CurPtr -= Size; in LexNumericConstant()
2042 C = getCharAndSize(CurPtr, Size); in LexNumericConstant()
2050 return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); in LexNumericConstant()
2063 std::find(BufferPtr, CurPtr, '_') != CurPtr) in LexNumericConstant()
2067 return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); in LexNumericConstant()
2072 auto [Next, NextSize] = getCharAndSizeNoWarn(CurPtr + Size, LangOpts); in LexNumericConstant()
2075 Diag(CurPtr, LangOpts.CPlusPlus in LexNumericConstant()
2078 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexNumericConstant()
2079 CurPtr = ConsumeChar(CurPtr, NextSize, Result); in LexNumericConstant()
2080 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
2085 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) in LexNumericConstant()
2086 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
2087 if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr, Result)) in LexNumericConstant()
2088 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
2092 FormTokenWithChars(Result, CurPtr, tok::numeric_constant); in LexNumericConstant()
2099 const char *Lexer::LexUDSuffix(Token &Result, const char *CurPtr, in LexUDSuffix() argument
2105 char C = getCharAndSize(CurPtr, Size); in LexUDSuffix()
2109 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) in LexUDSuffix()
2111 else if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr, Result)) in LexUDSuffix()
2114 return CurPtr; in LexUDSuffix()
2119 Diag(CurPtr, in LexUDSuffix()
2122 << FixItHint::CreateInsertion(getSourceLocation(CurPtr), " "); in LexUDSuffix()
2123 return CurPtr; in LexUDSuffix()
2145 getCharAndSizeNoWarn(CurPtr + Consumed, LangOpts); in LexUDSuffix()
2165 Diag(CurPtr, LangOpts.MSVCCompat in LexUDSuffix()
2168 << FixItHint::CreateInsertion(getSourceLocation(CurPtr), " "); in LexUDSuffix()
2169 return CurPtr; in LexUDSuffix()
2172 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexUDSuffix()
2177 C = getCharAndSize(CurPtr, Size); in LexUDSuffix()
2179 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexUDSuffix()
2180 } else if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) { in LexUDSuffix()
2181 } else if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr, Result)) { in LexUDSuffix()
2186 return CurPtr; in LexUDSuffix()
2191 bool Lexer::LexStringLiteral(Token &Result, const char *CurPtr, in LexStringLiteral() argument
2193 const char *AfterQuote = CurPtr; in LexStringLiteral()
2204 char C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
2209 C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
2212 (C == 0 && CurPtr-1 == BufferEnd)) { // End of file. in LexStringLiteral()
2215 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexStringLiteral()
2220 if (isCodeCompletionPoint(CurPtr-1)) { in LexStringLiteral()
2222 codeCompleteIncludedFile(AfterQuote, CurPtr - 1, /*IsAngled=*/false); in LexStringLiteral()
2225 FormTokenWithChars(Result, CurPtr - 1, tok::unknown); in LexStringLiteral()
2230 NulCharacter = CurPtr-1; in LexStringLiteral()
2232 C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
2237 CurPtr = LexUDSuffix(Result, CurPtr, true); in LexStringLiteral()
2245 FormTokenWithChars(Result, CurPtr, Kind); in LexStringLiteral()
2252 bool Lexer::LexRawStringLiteral(Token &Result, const char *CurPtr, in LexRawStringLiteral() argument
2264 while (PrefixLen != 16 && isRawStringDelimBody(CurPtr[PrefixLen])) { in LexRawStringLiteral()
2266 llvm::is_contained({'$', '@', '`'}, CurPtr[PrefixLen])) { in LexRawStringLiteral()
2267 const char *Pos = &CurPtr[PrefixLen]; in LexRawStringLiteral()
2277 if (CurPtr[PrefixLen] != '(') { in LexRawStringLiteral()
2279 const char *PrefixEnd = &CurPtr[PrefixLen]; in LexRawStringLiteral()
2294 char C = *CurPtr++; in LexRawStringLiteral()
2298 if (C == 0 && CurPtr-1 == BufferEnd) { in LexRawStringLiteral()
2299 --CurPtr; in LexRawStringLiteral()
2304 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexRawStringLiteral()
2309 const char *Prefix = CurPtr; in LexRawStringLiteral()
2310 CurPtr += PrefixLen + 1; // skip over prefix and '(' in LexRawStringLiteral()
2313 char C = *CurPtr++; in LexRawStringLiteral()
2317 if (strncmp(CurPtr, Prefix, PrefixLen) == 0 && CurPtr[PrefixLen] == '"') { in LexRawStringLiteral()
2318 CurPtr += PrefixLen + 1; // skip over prefix and '"' in LexRawStringLiteral()
2321 } else if (C == 0 && CurPtr-1 == BufferEnd) { // End of file. in LexRawStringLiteral()
2325 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexRawStringLiteral()
2332 CurPtr = LexUDSuffix(Result, CurPtr, true); in LexRawStringLiteral()
2336 FormTokenWithChars(Result, CurPtr, Kind); in LexRawStringLiteral()
2343 bool Lexer::LexAngledStringLiteral(Token &Result, const char *CurPtr) { in LexAngledStringLiteral() argument
2346 const char *AfterLessPos = CurPtr; in LexAngledStringLiteral()
2347 char C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2352 C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2355 (C == 0 && (CurPtr - 1 == BufferEnd))) { // End of file. in LexAngledStringLiteral()
2363 if (isCodeCompletionPoint(CurPtr - 1)) { in LexAngledStringLiteral()
2364 codeCompleteIncludedFile(AfterLessPos, CurPtr - 1, /*IsAngled=*/true); in LexAngledStringLiteral()
2366 FormTokenWithChars(Result, CurPtr - 1, tok::unknown); in LexAngledStringLiteral()
2369 NulCharacter = CurPtr-1; in LexAngledStringLiteral()
2371 C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2380 FormTokenWithChars(Result, CurPtr, tok::header_name); in LexAngledStringLiteral()
2420 bool Lexer::LexCharConstant(Token &Result, const char *CurPtr, in LexCharConstant() argument
2434 char C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2438 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexCharConstant()
2445 C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2448 (C == 0 && CurPtr-1 == BufferEnd)) { // End of file. in LexCharConstant()
2451 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexCharConstant()
2456 if (isCodeCompletionPoint(CurPtr-1)) { in LexCharConstant()
2458 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexCharConstant()
2463 NulCharacter = CurPtr-1; in LexCharConstant()
2465 C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2470 CurPtr = LexUDSuffix(Result, CurPtr, false); in LexCharConstant()
2478 FormTokenWithChars(Result, CurPtr, Kind); in LexCharConstant()
2487 bool Lexer::SkipWhitespace(Token &Result, const char *CurPtr, in SkipWhitespace() argument
2490 bool SawNewline = isVerticalWhitespace(CurPtr[-1]); in SkipWhitespace()
2492 unsigned char Char = *CurPtr; in SkipWhitespace()
2501 setLastNewLine(CurPtr - 1); in SkipWhitespace()
2507 Char = *++CurPtr; in SkipWhitespace()
2515 BufferPtr = CurPtr; in SkipWhitespace()
2520 if (*CurPtr == '\n') in SkipWhitespace()
2521 setLastNewLine(CurPtr); in SkipWhitespace()
2523 Char = *++CurPtr; in SkipWhitespace()
2528 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipWhitespace()
2538 char PrevChar = CurPtr[-1]; in SkipWhitespace()
2553 BufferPtr = CurPtr; in SkipWhitespace()
2563 bool Lexer::SkipLineComment(Token &Result, const char *CurPtr, in SkipLineComment() argument
2591 C = *CurPtr; in SkipLineComment()
2595 C = *++CurPtr; in SkipLineComment()
2601 (const llvm::UTF8 *)CurPtr, (const llvm::UTF8 *)BufferEnd); in SkipLineComment()
2604 Diag(CurPtr, diag::warn_invalid_utf8_in_comment); in SkipLineComment()
2606 ++CurPtr; in SkipLineComment()
2609 CurPtr += Length; in SkipLineComment()
2614 const char *NextLine = CurPtr; in SkipLineComment()
2617 const char *EscapePtr = CurPtr-1; in SkipLineComment()
2626 CurPtr = EscapePtr; in SkipLineComment()
2630 CurPtr = EscapePtr-2; in SkipLineComment()
2643 const char *OldPtr = CurPtr; in SkipLineComment()
2646 C = getAndAdvanceChar(CurPtr, Result); in SkipLineComment()
2651 if (C != 0 && CurPtr == OldPtr+1) { in SkipLineComment()
2652 CurPtr = NextLine; in SkipLineComment()
2659 if (CurPtr != OldPtr + 1 && C != '/' && in SkipLineComment()
2660 (CurPtr == BufferEnd + 1 || CurPtr[0] != '/')) { in SkipLineComment()
2661 for (; OldPtr != CurPtr; ++OldPtr) in SkipLineComment()
2666 const char *ForwardPtr = CurPtr; in SkipLineComment()
2679 if (C == '\r' || C == '\n' || CurPtr == BufferEnd + 1) { in SkipLineComment()
2680 --CurPtr; in SkipLineComment()
2684 if (C == '\0' && isCodeCompletionPoint(CurPtr-1)) { in SkipLineComment()
2695 getSourceLocation(CurPtr)))) { in SkipLineComment()
2696 BufferPtr = CurPtr; in SkipLineComment()
2702 return SaveLineComment(Result, CurPtr); in SkipLineComment()
2706 if (ParsingPreprocessorDirective || CurPtr == BufferEnd) { in SkipLineComment()
2707 BufferPtr = CurPtr; in SkipLineComment()
2716 NewLinePtr = CurPtr++; in SkipLineComment()
2723 BufferPtr = CurPtr; in SkipLineComment()
2729 bool Lexer::SaveLineComment(Token &Result, const char *CurPtr) { in SaveLineComment() argument
2732 FormTokenWithChars(Result, CurPtr, tok::comment); in SaveLineComment()
2757 static bool isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr, Lexer *L, in isEndOfBlockCommentWithEscapedNewLine() argument
2759 assert(CurPtr[0] == '\n' || CurPtr[0] == '\r'); in isEndOfBlockCommentWithEscapedNewLine()
2768 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2771 if (CurPtr[0] == '\n' || CurPtr[0] == '\r') { in isEndOfBlockCommentWithEscapedNewLine()
2773 if (CurPtr[0] == CurPtr[1]) in isEndOfBlockCommentWithEscapedNewLine()
2776 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2781 while (isHorizontalWhitespace(*CurPtr) || *CurPtr == 0) { in isEndOfBlockCommentWithEscapedNewLine()
2782 SpacePos = CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2783 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2787 if (*CurPtr == '\\') { in isEndOfBlockCommentWithEscapedNewLine()
2788 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2789 } else if (CurPtr[0] == '/' && CurPtr[-1] == '?' && CurPtr[-2] == '?') { in isEndOfBlockCommentWithEscapedNewLine()
2791 TrigraphPos = CurPtr - 2; in isEndOfBlockCommentWithEscapedNewLine()
2792 CurPtr -= 3; in isEndOfBlockCommentWithEscapedNewLine()
2799 if (*CurPtr == '*') in isEndOfBlockCommentWithEscapedNewLine()
2802 if (*CurPtr != '\n' && *CurPtr != '\r') in isEndOfBlockCommentWithEscapedNewLine()
2820 L->Diag(CurPtr + 1, diag::escaped_newline_block_comment_end); in isEndOfBlockCommentWithEscapedNewLine()
2845 bool Lexer::SkipBlockComment(Token &Result, const char *CurPtr, in SkipBlockComment() argument
2856 unsigned char C = getCharAndSize(CurPtr, CharSize); in SkipBlockComment()
2857 CurPtr += CharSize; in SkipBlockComment()
2858 if (C == 0 && CurPtr == BufferEnd+1) { in SkipBlockComment()
2861 --CurPtr; in SkipBlockComment()
2866 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipBlockComment()
2870 BufferPtr = CurPtr; in SkipBlockComment()
2877 C = *CurPtr++; in SkipBlockComment()
2888 if (CurPtr + 24 < BufferEnd && in SkipBlockComment()
2893 while (C != '/' && (intptr_t)CurPtr % 16 != 0) { in SkipBlockComment()
2896 C = *CurPtr++; in SkipBlockComment()
2902 while (CurPtr + 16 < BufferEnd) { in SkipBlockComment()
2903 int Mask = _mm_movemask_epi8(*(const __m128i *)CurPtr); in SkipBlockComment()
2908 int cmp = _mm_movemask_epi8(_mm_cmpeq_epi8(*(const __m128i*)CurPtr, in SkipBlockComment()
2914 CurPtr += llvm::countr_zero<unsigned>(cmp) + 1; in SkipBlockComment()
2917 CurPtr += 16; in SkipBlockComment()
2927 while (CurPtr + 16 < BufferEnd) { in SkipBlockComment()
2929 vec_any_ge(*(const __vector unsigned char *)CurPtr, LongUTF))) in SkipBlockComment()
2931 if (vec_any_eq(*(const __vector unsigned char *)CurPtr, Slashes)) { in SkipBlockComment()
2934 CurPtr += 16; in SkipBlockComment()
2938 while (CurPtr + 16 < BufferEnd) { in SkipBlockComment()
2941 HasNonASCII |= !isASCII(CurPtr[I]); in SkipBlockComment()
2948 HasSlash |= CurPtr[I] == '/'; in SkipBlockComment()
2951 CurPtr += 16; in SkipBlockComment()
2956 C = *CurPtr++; in SkipBlockComment()
2965 C = *CurPtr++; in SkipBlockComment()
2972 (const llvm::UTF8 *)CurPtr - 1, (const llvm::UTF8 *)BufferEnd); in SkipBlockComment()
2975 Diag(CurPtr - 1, diag::warn_invalid_utf8_in_comment); in SkipBlockComment()
2979 CurPtr += Length - 1; in SkipBlockComment()
2981 C = *CurPtr++; in SkipBlockComment()
2986 if (CurPtr[-2] == '*') // We found the final */. We're done! in SkipBlockComment()
2989 if ((CurPtr[-2] == '\n' || CurPtr[-2] == '\r')) { in SkipBlockComment()
2990 if (isEndOfBlockCommentWithEscapedNewLine(CurPtr - 2, this, in SkipBlockComment()
2997 if (CurPtr[0] == '*' && CurPtr[1] != '/') { in SkipBlockComment()
3002 Diag(CurPtr-1, diag::warn_nested_block_comment); in SkipBlockComment()
3004 } else if (C == 0 && CurPtr == BufferEnd+1) { in SkipBlockComment()
3010 --CurPtr; in SkipBlockComment()
3015 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipBlockComment()
3019 BufferPtr = CurPtr; in SkipBlockComment()
3021 } else if (C == '\0' && isCodeCompletionPoint(CurPtr-1)) { in SkipBlockComment()
3027 C = *CurPtr++; in SkipBlockComment()
3033 getSourceLocation(CurPtr)))) { in SkipBlockComment()
3034 BufferPtr = CurPtr; in SkipBlockComment()
3040 FormTokenWithChars(Result, CurPtr, tok::comment); in SkipBlockComment()
3048 if (isHorizontalWhitespace(*CurPtr)) { in SkipBlockComment()
3049 SkipWhitespace(Result, CurPtr+1, TokAtPhysicalStartOfLine); in SkipBlockComment()
3054 BufferPtr = CurPtr; in SkipBlockComment()
3072 const char *CurPtr = BufferPtr; in ReadToEndOfLine() local
3074 char Char = getAndAdvanceChar(CurPtr, Tmp); in ReadToEndOfLine()
3082 if (CurPtr-1 != BufferEnd) { in ReadToEndOfLine()
3083 if (isCodeCompletionPoint(CurPtr-1)) { in ReadToEndOfLine()
3099 assert(CurPtr[-1] == Char && "Trigraphs for newline?"); in ReadToEndOfLine()
3100 BufferPtr = CurPtr-1; in ReadToEndOfLine()
3121 bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) { in LexEndOfFile() argument
3129 FormTokenWithChars(Result, CurPtr, tok::eod); in LexEndOfFile()
3168 if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')) { in LexEndOfFile()
3190 BufferPtr = CurPtr; in LexEndOfFile()
3241 static const char *FindConflictEnd(const char *CurPtr, const char *BufferEnd, in FindConflictEnd() argument
3245 auto RestOfBuffer = StringRef(CurPtr, BufferEnd - CurPtr).substr(TermLen); in FindConflictEnd()
3264 bool Lexer::IsStartOfConflictMarker(const char *CurPtr) { in IsStartOfConflictMarker() argument
3266 if (CurPtr != BufferStart && in IsStartOfConflictMarker()
3267 CurPtr[-1] != '\n' && CurPtr[-1] != '\r') in IsStartOfConflictMarker()
3271 if (!StringRef(CurPtr, BufferEnd - CurPtr).starts_with("<<<<<<<") && in IsStartOfConflictMarker()
3272 !StringRef(CurPtr, BufferEnd - CurPtr).starts_with(">>>> ")) in IsStartOfConflictMarker()
3280 ConflictMarkerKind Kind = *CurPtr == '<' ? CMK_Normal : CMK_Perforce; in IsStartOfConflictMarker()
3284 if (FindConflictEnd(CurPtr, BufferEnd, Kind)) { in IsStartOfConflictMarker()
3287 Diag(CurPtr, diag::err_conflict_marker); in IsStartOfConflictMarker()
3292 while (*CurPtr != '\r' && *CurPtr != '\n') { in IsStartOfConflictMarker()
3293 assert(CurPtr != BufferEnd && "Didn't find end of line"); in IsStartOfConflictMarker()
3294 ++CurPtr; in IsStartOfConflictMarker()
3296 BufferPtr = CurPtr; in IsStartOfConflictMarker()
3308 bool Lexer::HandleEndOfConflictMarker(const char *CurPtr) { in HandleEndOfConflictMarker() argument
3310 if (CurPtr != BufferStart && in HandleEndOfConflictMarker()
3311 CurPtr[-1] != '\n' && CurPtr[-1] != '\r') in HandleEndOfConflictMarker()
3321 if (CurPtr[i] != CurPtr[0]) in HandleEndOfConflictMarker()
3327 if (const char *End = FindConflictEnd(CurPtr, BufferEnd, in HandleEndOfConflictMarker()
3329 CurPtr = End; in HandleEndOfConflictMarker()
3332 while (CurPtr != BufferEnd && *CurPtr != '\r' && *CurPtr != '\n') in HandleEndOfConflictMarker()
3333 ++CurPtr; in HandleEndOfConflictMarker()
3335 BufferPtr = CurPtr; in HandleEndOfConflictMarker()
3345 static const char *findPlaceholderEnd(const char *CurPtr, in findPlaceholderEnd() argument
3347 if (CurPtr == BufferEnd) in findPlaceholderEnd()
3350 for (; CurPtr != BufferEnd; ++CurPtr) { in findPlaceholderEnd()
3351 if (CurPtr[0] == '#' && CurPtr[1] == '>') in findPlaceholderEnd()
3352 return CurPtr + 2; in findPlaceholderEnd()
3357 bool Lexer::lexEditorPlaceholder(Token &Result, const char *CurPtr) { in lexEditorPlaceholder() argument
3358 assert(CurPtr[-1] == '<' && CurPtr[0] == '#' && "Not a placeholder!"); in lexEditorPlaceholder()
3361 const char *End = findPlaceholderEnd(CurPtr + 1, BufferEnd); in lexEditorPlaceholder()
3364 const char *Start = CurPtr - 1; in lexEditorPlaceholder()
3376 bool Lexer::isCodeCompletionPoint(const char *CurPtr) const { in isCodeCompletionPoint()
3378 SourceLocation Loc = FileLoc.getLocWithOffset(CurPtr-BufferStart); in isCodeCompletionPoint()
3409 const char *CurPtr = StartPtr + CharSize; in tryReadNumericUCN() local
3410 const char *KindLoc = &CurPtr[-1]; in tryReadNumericUCN()
3414 char C = getCharAndSize(CurPtr, CharSize); in tryReadNumericUCN()
3417 CurPtr += CharSize; in tryReadNumericUCN()
3422 CurPtr += CharSize; in tryReadNumericUCN()
3445 CurPtr += CharSize; in tryReadNumericUCN()
3488 if (CurPtr - StartPtr == (ptrdiff_t)(Count + 1 + (Delimited ? 2 : 0))) in tryReadNumericUCN()
3489 StartPtr = CurPtr; in tryReadNumericUCN()
3491 while (StartPtr != CurPtr) in tryReadNumericUCN()
3494 StartPtr = CurPtr; in tryReadNumericUCN()
3508 const char *CurPtr = StartPtr + CharSize; in tryReadNamedUCN() local
3509 const char *KindLoc = &CurPtr[-1]; in tryReadNamedUCN()
3511 C = getCharAndSize(CurPtr, CharSize); in tryReadNamedUCN()
3517 CurPtr += CharSize; in tryReadNamedUCN()
3518 const char *StartName = CurPtr; in tryReadNamedUCN()
3522 C = getCharAndSize(CurPtr, CharSize); in tryReadNamedUCN()
3523 CurPtr += CharSize; in tryReadNamedUCN()
3551 << makeCharRange(*this, StartName, CurPtr - CharSize); in tryReadNamedUCN()
3555 makeCharRange(*this, StartName, CurPtr - CharSize), in tryReadNamedUCN()
3582 if (CurPtr - StartPtr == (ptrdiff_t)(Buffer.size() + 3)) in tryReadNamedUCN()
3583 StartPtr = CurPtr; in tryReadNamedUCN()
3585 while (StartPtr != CurPtr) in tryReadNamedUCN()
3588 StartPtr = CurPtr; in tryReadNamedUCN()
3659 const char *CurPtr) { in CheckUnicodeWhitespace() argument
3663 << makeCharRange(*this, BufferPtr, CurPtr); in CheckUnicodeWhitespace()
3721 const char *CurPtr = BufferPtr; in LexTokenInternal() local
3724 if (isHorizontalWhitespace(*CurPtr)) { in LexTokenInternal()
3726 ++CurPtr; in LexTokenInternal()
3727 } while (isHorizontalWhitespace(*CurPtr)); in LexTokenInternal()
3733 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexTokenInternal()
3738 BufferPtr = CurPtr; in LexTokenInternal()
3745 char Char = getAndAdvanceChar(CurPtr, Result); in LexTokenInternal()
3754 if (CurPtr-1 == BufferEnd) in LexTokenInternal()
3755 return LexEndOfFile(Result, CurPtr-1); in LexTokenInternal()
3758 if (isCodeCompletionPoint(CurPtr-1)) { in LexTokenInternal()
3761 FormTokenWithChars(Result, CurPtr, tok::code_completion); in LexTokenInternal()
3766 Diag(CurPtr-1, diag::null_in_file); in LexTokenInternal()
3768 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3779 Diag(CurPtr-1, diag::ext_ctrl_z_eof_microsoft); in LexTokenInternal()
3780 return LexEndOfFile(Result, CurPtr-1); in LexTokenInternal()
3788 if (CurPtr[0] == '\n') in LexTokenInternal()
3789 (void)getAndAdvanceChar(CurPtr, Result); in LexTokenInternal()
3805 NewLinePtr = CurPtr - 1; in LexTokenInternal()
3814 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3826 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3830 CurPtr = BufferPtr; in LexTokenInternal()
3834 if (CurPtr[0] == '/' && CurPtr[1] == '/' && !inKeepCommentMode() && in LexTokenInternal()
3836 if (SkipLineComment(Result, CurPtr+2, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3839 } else if (CurPtr[0] == '/' && CurPtr[1] == '*' && !inKeepCommentMode()) { in LexTokenInternal()
3840 if (SkipBlockComment(Result, CurPtr+2, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3843 } else if (isHorizontalWhitespace(*CurPtr)) { in LexTokenInternal()
3856 return LexNumericConstant(Result, CurPtr); in LexTokenInternal()
3866 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3870 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3875 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3880 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3882 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3887 char Char2 = getCharAndSize(CurPtr + SizeTmp, SizeTmp2); in LexTokenInternal()
3892 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3897 Result, ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3903 char Char3 = getCharAndSize(CurPtr + SizeTmp + SizeTmp2, SizeTmp3); in LexTokenInternal()
3907 ConsumeChar(ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3917 return LexIdentifierContinue(Result, CurPtr); in LexTokenInternal()
3924 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3928 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3933 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3938 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3940 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3946 return LexIdentifierContinue(Result, CurPtr); in LexTokenInternal()
3953 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3957 ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3962 return LexIdentifierContinue(Result, CurPtr); in LexTokenInternal()
3967 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3971 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3976 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3978 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3984 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4001 return LexIdentifierContinue(Result, CurPtr); in LexTokenInternal()
4006 Diag(CurPtr-1, diag::ext_dollar_in_identifier); in LexTokenInternal()
4009 return LexIdentifierContinue(Result, CurPtr); in LexTokenInternal()
4019 return LexCharConstant(Result, CurPtr, tok::char_constant); in LexTokenInternal()
4025 return LexStringLiteral(Result, CurPtr, in LexTokenInternal()
4052 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4057 return LexNumericConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result)); in LexTokenInternal()
4060 CurPtr += SizeTmp; in LexTokenInternal()
4062 getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '.') { in LexTokenInternal()
4064 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4071 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4074 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4077 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4083 if (getCharAndSize(CurPtr, SizeTmp) == '=') { in LexTokenInternal()
4085 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4091 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4093 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4096 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4103 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4105 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4108 getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '*') { // C++ ->* in LexTokenInternal()
4109 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4113 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4116 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4126 if (getCharAndSize(CurPtr, SizeTmp) == '=') { in LexTokenInternal()
4128 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4135 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4149 TreatAsComment = getCharAndSize(CurPtr+SizeTmp, SizeTmp2) != '*'; in LexTokenInternal()
4152 if (SkipLineComment(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4164 if (SkipBlockComment(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4174 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4181 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4184 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4187 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4189 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4190 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4191 if (Char == '%' && getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == ':') { in LexTokenInternal()
4193 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4196 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4215 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4217 return LexAngledStringLiteral(Result, CurPtr); in LexTokenInternal()
4219 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
4222 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4224 } else if (After == '<' && IsStartOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
4228 } else if (After == '<' && HandleEndOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
4234 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4237 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4241 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
4246 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4256 getSourceLocation(CurPtr + SizeTmp, SizeTmp2), " "); in LexTokenInternal()
4259 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4263 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == ':') { in LexTokenInternal()
4270 char After = getCharAndSize(CurPtr + SizeTmp + SizeTmp2, SizeTmp3); in LexTokenInternal()
4279 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4282 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4285 lexEditorPlaceholder(Result, CurPtr)) { in LexTokenInternal()
4292 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4294 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4297 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
4299 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4302 } else if (After == '>' && IsStartOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
4306 } else if (After == '>' && HandleEndOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
4311 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4314 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4322 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4324 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4327 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4334 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4337 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4340 if (CurPtr[1] == '|' && HandleEndOfConflictMarker(CurPtr-1)) in LexTokenInternal()
4343 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4349 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4352 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4355 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4364 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4367 if (CurPtr[1] == '=' && HandleEndOfConflictMarker(CurPtr-1)) in LexTokenInternal()
4371 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4380 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4383 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4388 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4403 if (CurPtr[-1] == '@' && LangOpts.ObjC) in LexTokenInternal()
4412 if (uint32_t CodePoint = tryReadUCN(CurPtr, BufferPtr, &Result)) { in LexTokenInternal()
4413 if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) { in LexTokenInternal()
4414 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
4422 return LexUnicodeIdentifierStart(Result, CodePoint, CurPtr); in LexTokenInternal()
4439 --CurPtr; in LexTokenInternal()
4441 llvm::convertUTF8Sequence((const llvm::UTF8 **)&CurPtr, in LexTokenInternal()
4446 if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) { in LexTokenInternal()
4447 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
4454 return LexUnicodeIdentifierStart(Result, CodePoint, CurPtr); in LexTokenInternal()
4459 ++CurPtr; in LexTokenInternal()
4467 Diag(CurPtr, diag::err_invalid_utf8); in LexTokenInternal()
4469 BufferPtr = CurPtr+1; in LexTokenInternal()
4481 FormTokenWithChars(Result, CurPtr, Kind); in LexTokenInternal()
4487 FormTokenWithChars(Result, CurPtr, tok::hash); in LexTokenInternal()