Lines Matching refs:CurPtr
603 const char *CurPtr = Buffer.begin(); in ComputePreamble() local
605 while (CurPtr != Buffer.end()) { in ComputePreamble()
606 char ch = *CurPtr++; in ComputePreamble()
613 if (CurPtr != Buffer.end()) in ComputePreamble()
614 MaxLineOffset = CurPtr - Buffer.begin(); in ComputePreamble()
1611 bool Lexer::tryConsumeIdentifierUCN(const char *&CurPtr, unsigned Size, in tryConsumeIdentifierUCN() argument
1613 const char *UCNPtr = CurPtr + Size; in tryConsumeIdentifierUCN()
1614 uint32_t CodePoint = tryReadUCN(UCNPtr, CurPtr, /*Token=*/nullptr); in tryConsumeIdentifierUCN()
1620 makeCharRange(*this, CurPtr, UCNPtr), in tryConsumeIdentifierUCN()
1624 if ((UCNPtr - CurPtr == 6 && CurPtr[1] == 'u') || in tryConsumeIdentifierUCN()
1625 (UCNPtr - CurPtr == 10 && CurPtr[1] == 'U')) in tryConsumeIdentifierUCN()
1626 CurPtr = UCNPtr; in tryConsumeIdentifierUCN()
1628 while (CurPtr != UCNPtr) in tryConsumeIdentifierUCN()
1629 (void)getAndAdvanceChar(CurPtr, Result); in tryConsumeIdentifierUCN()
1633 bool Lexer::tryConsumeIdentifierUTF8Char(const char *&CurPtr) { in tryConsumeIdentifierUTF8Char() argument
1634 const char *UnicodePtr = CurPtr; in tryConsumeIdentifierUTF8Char()
1647 makeCharRange(*this, CurPtr, UnicodePtr), in tryConsumeIdentifierUTF8Char()
1650 makeCharRange(*this, CurPtr, UnicodePtr)); in tryConsumeIdentifierUTF8Char()
1653 CurPtr = UnicodePtr; in tryConsumeIdentifierUTF8Char()
1657 bool Lexer::LexIdentifier(Token &Result, const char *CurPtr) { in LexIdentifier() argument
1660 unsigned char C = *CurPtr++; in LexIdentifier()
1662 C = *CurPtr++; in LexIdentifier()
1664 --CurPtr; // Back up over the skipped character. in LexIdentifier()
1675 FormTokenWithChars(Result, CurPtr, tok::raw_identifier); in LexIdentifier()
1692 if (isCodeCompletionPoint(CurPtr)) { in LexIdentifier()
1700 assert(*CurPtr == 0 && "Completion character must be 0"); in LexIdentifier()
1701 ++CurPtr; in LexIdentifier()
1705 if (CurPtr < BufferEnd) { in LexIdentifier()
1706 while (isIdentifierBody(*CurPtr)) in LexIdentifier()
1707 ++CurPtr; in LexIdentifier()
1709 BufferPtr = CurPtr; in LexIdentifier()
1723 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1731 Diag(CurPtr, diag::ext_dollar_in_identifier); in LexIdentifier()
1732 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexIdentifier()
1733 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1735 } else if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) { in LexIdentifier()
1736 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1738 } else if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) { in LexIdentifier()
1739 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1746 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexIdentifier()
1748 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1750 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexIdentifier()
1751 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1770 bool Lexer::LexNumericConstant(Token &Result, const char *CurPtr) { in LexNumericConstant() argument
1772 char C = getCharAndSize(CurPtr, Size); in LexNumericConstant()
1775 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexNumericConstant()
1777 C = getCharAndSize(CurPtr, Size); in LexNumericConstant()
1785 return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); in LexNumericConstant()
1798 std::find(BufferPtr, CurPtr, '_') != CurPtr) in LexNumericConstant()
1802 return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); in LexNumericConstant()
1808 char Next = getCharAndSizeNoWarn(CurPtr + Size, NextSize, getLangOpts()); in LexNumericConstant()
1811 Diag(CurPtr, getLangOpts().CPlusPlus in LexNumericConstant()
1814 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexNumericConstant()
1815 CurPtr = ConsumeChar(CurPtr, NextSize, Result); in LexNumericConstant()
1816 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
1821 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) in LexNumericConstant()
1822 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
1823 if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) in LexNumericConstant()
1824 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
1828 FormTokenWithChars(Result, CurPtr, tok::numeric_constant); in LexNumericConstant()
1835 const char *Lexer::LexUDSuffix(Token &Result, const char *CurPtr, in LexUDSuffix() argument
1841 char C = getCharAndSize(CurPtr, Size); in LexUDSuffix()
1845 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) in LexUDSuffix()
1847 else if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) in LexUDSuffix()
1850 return CurPtr; in LexUDSuffix()
1855 Diag(CurPtr, in LexUDSuffix()
1858 << FixItHint::CreateInsertion(getSourceLocation(CurPtr), " "); in LexUDSuffix()
1859 return CurPtr; in LexUDSuffix()
1881 char Next = getCharAndSizeNoWarn(CurPtr + Consumed, NextSize, in LexUDSuffix()
1902 Diag(CurPtr, getLangOpts().MSVCCompat in LexUDSuffix()
1905 << FixItHint::CreateInsertion(getSourceLocation(CurPtr), " "); in LexUDSuffix()
1906 return CurPtr; in LexUDSuffix()
1909 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexUDSuffix()
1914 C = getCharAndSize(CurPtr, Size); in LexUDSuffix()
1915 if (isIdentifierBody(C)) { CurPtr = ConsumeChar(CurPtr, Size, Result); } in LexUDSuffix()
1916 else if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) {} in LexUDSuffix()
1917 else if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) {} in LexUDSuffix()
1921 return CurPtr; in LexUDSuffix()
1926 bool Lexer::LexStringLiteral(Token &Result, const char *CurPtr, in LexStringLiteral() argument
1928 const char *AfterQuote = CurPtr; in LexStringLiteral()
1940 char C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
1945 C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
1948 (C == 0 && CurPtr-1 == BufferEnd)) { // End of file. in LexStringLiteral()
1951 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexStringLiteral()
1956 if (isCodeCompletionPoint(CurPtr-1)) { in LexStringLiteral()
1958 codeCompleteIncludedFile(AfterQuote, CurPtr - 1, /*IsAngled=*/false); in LexStringLiteral()
1961 FormTokenWithChars(Result, CurPtr - 1, tok::unknown); in LexStringLiteral()
1966 NulCharacter = CurPtr-1; in LexStringLiteral()
1968 C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
1973 CurPtr = LexUDSuffix(Result, CurPtr, true); in LexStringLiteral()
1981 FormTokenWithChars(Result, CurPtr, Kind); in LexStringLiteral()
1988 bool Lexer::LexRawStringLiteral(Token &Result, const char *CurPtr, in LexRawStringLiteral() argument
2000 while (PrefixLen != 16 && isRawStringDelimBody(CurPtr[PrefixLen])) in LexRawStringLiteral()
2004 if (CurPtr[PrefixLen] != '(') { in LexRawStringLiteral()
2006 const char *PrefixEnd = &CurPtr[PrefixLen]; in LexRawStringLiteral()
2019 char C = *CurPtr++; in LexRawStringLiteral()
2023 if (C == 0 && CurPtr-1 == BufferEnd) { in LexRawStringLiteral()
2024 --CurPtr; in LexRawStringLiteral()
2029 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexRawStringLiteral()
2034 const char *Prefix = CurPtr; in LexRawStringLiteral()
2035 CurPtr += PrefixLen + 1; // skip over prefix and '(' in LexRawStringLiteral()
2038 char C = *CurPtr++; in LexRawStringLiteral()
2042 if (strncmp(CurPtr, Prefix, PrefixLen) == 0 && CurPtr[PrefixLen] == '"') { in LexRawStringLiteral()
2043 CurPtr += PrefixLen + 1; // skip over prefix and '"' in LexRawStringLiteral()
2046 } else if (C == 0 && CurPtr-1 == BufferEnd) { // End of file. in LexRawStringLiteral()
2050 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexRawStringLiteral()
2057 CurPtr = LexUDSuffix(Result, CurPtr, true); in LexRawStringLiteral()
2061 FormTokenWithChars(Result, CurPtr, Kind); in LexRawStringLiteral()
2068 bool Lexer::LexAngledStringLiteral(Token &Result, const char *CurPtr) { in LexAngledStringLiteral() argument
2071 const char *AfterLessPos = CurPtr; in LexAngledStringLiteral()
2072 char C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2077 C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2080 (C == 0 && (CurPtr - 1 == BufferEnd))) { // End of file. in LexAngledStringLiteral()
2088 if (isCodeCompletionPoint(CurPtr - 1)) { in LexAngledStringLiteral()
2089 codeCompleteIncludedFile(AfterLessPos, CurPtr - 1, /*IsAngled=*/true); in LexAngledStringLiteral()
2091 FormTokenWithChars(Result, CurPtr - 1, tok::unknown); in LexAngledStringLiteral()
2094 NulCharacter = CurPtr-1; in LexAngledStringLiteral()
2096 C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2105 FormTokenWithChars(Result, CurPtr, tok::header_name); in LexAngledStringLiteral()
2145 bool Lexer::LexCharConstant(Token &Result, const char *CurPtr, in LexCharConstant() argument
2159 char C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2163 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexCharConstant()
2170 C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2173 (C == 0 && CurPtr-1 == BufferEnd)) { // End of file. in LexCharConstant()
2176 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexCharConstant()
2181 if (isCodeCompletionPoint(CurPtr-1)) { in LexCharConstant()
2183 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexCharConstant()
2188 NulCharacter = CurPtr-1; in LexCharConstant()
2190 C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2195 CurPtr = LexUDSuffix(Result, CurPtr, false); in LexCharConstant()
2203 FormTokenWithChars(Result, CurPtr, Kind); in LexCharConstant()
2212 bool Lexer::SkipWhitespace(Token &Result, const char *CurPtr, in SkipWhitespace() argument
2215 bool SawNewline = isVerticalWhitespace(CurPtr[-1]); in SkipWhitespace()
2217 unsigned char Char = *CurPtr; in SkipWhitespace()
2226 setLastNewLine(CurPtr - 1); in SkipWhitespace()
2232 Char = *++CurPtr; in SkipWhitespace()
2240 BufferPtr = CurPtr; in SkipWhitespace()
2245 if (*CurPtr == '\n') in SkipWhitespace()
2246 setLastNewLine(CurPtr); in SkipWhitespace()
2248 Char = *++CurPtr; in SkipWhitespace()
2253 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipWhitespace()
2263 char PrevChar = CurPtr[-1]; in SkipWhitespace()
2278 BufferPtr = CurPtr; in SkipWhitespace()
2288 bool Lexer::SkipLineComment(Token &Result, const char *CurPtr, in SkipLineComment() argument
2308 C = *CurPtr; in SkipLineComment()
2312 C = *++CurPtr; in SkipLineComment()
2314 const char *NextLine = CurPtr; in SkipLineComment()
2317 const char *EscapePtr = CurPtr-1; in SkipLineComment()
2326 CurPtr = EscapePtr; in SkipLineComment()
2330 CurPtr = EscapePtr-2; in SkipLineComment()
2343 const char *OldPtr = CurPtr; in SkipLineComment()
2346 C = getAndAdvanceChar(CurPtr, Result); in SkipLineComment()
2351 if (C != 0 && CurPtr == OldPtr+1) { in SkipLineComment()
2352 CurPtr = NextLine; in SkipLineComment()
2359 if (CurPtr != OldPtr + 1 && C != '/' && in SkipLineComment()
2360 (CurPtr == BufferEnd + 1 || CurPtr[0] != '/')) { in SkipLineComment()
2361 for (; OldPtr != CurPtr; ++OldPtr) in SkipLineComment()
2366 const char *ForwardPtr = CurPtr; in SkipLineComment()
2379 if (C == '\r' || C == '\n' || CurPtr == BufferEnd + 1) { in SkipLineComment()
2380 --CurPtr; in SkipLineComment()
2384 if (C == '\0' && isCodeCompletionPoint(CurPtr-1)) { in SkipLineComment()
2395 getSourceLocation(CurPtr)))) { in SkipLineComment()
2396 BufferPtr = CurPtr; in SkipLineComment()
2402 return SaveLineComment(Result, CurPtr); in SkipLineComment()
2406 if (ParsingPreprocessorDirective || CurPtr == BufferEnd) { in SkipLineComment()
2407 BufferPtr = CurPtr; in SkipLineComment()
2416 NewLinePtr = CurPtr++; in SkipLineComment()
2423 BufferPtr = CurPtr; in SkipLineComment()
2429 bool Lexer::SaveLineComment(Token &Result, const char *CurPtr) { in SaveLineComment() argument
2432 FormTokenWithChars(Result, CurPtr, tok::comment); in SaveLineComment()
2457 static bool isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr, in isEndOfBlockCommentWithEscapedNewLine() argument
2459 assert(CurPtr[0] == '\n' || CurPtr[0] == '\r'); in isEndOfBlockCommentWithEscapedNewLine()
2468 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2471 if (CurPtr[0] == '\n' || CurPtr[0] == '\r') { in isEndOfBlockCommentWithEscapedNewLine()
2473 if (CurPtr[0] == CurPtr[1]) in isEndOfBlockCommentWithEscapedNewLine()
2476 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2481 while (isHorizontalWhitespace(*CurPtr) || *CurPtr == 0) { in isEndOfBlockCommentWithEscapedNewLine()
2482 SpacePos = CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2483 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2487 if (*CurPtr == '\\') { in isEndOfBlockCommentWithEscapedNewLine()
2488 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2489 } else if (CurPtr[0] == '/' && CurPtr[-1] == '?' && CurPtr[-2] == '?') { in isEndOfBlockCommentWithEscapedNewLine()
2491 TrigraphPos = CurPtr - 2; in isEndOfBlockCommentWithEscapedNewLine()
2492 CurPtr -= 3; in isEndOfBlockCommentWithEscapedNewLine()
2499 if (*CurPtr == '*') in isEndOfBlockCommentWithEscapedNewLine()
2502 if (*CurPtr != '\n' && *CurPtr != '\r') in isEndOfBlockCommentWithEscapedNewLine()
2520 L->Diag(CurPtr + 1, diag::escaped_newline_block_comment_end); in isEndOfBlockCommentWithEscapedNewLine()
2545 bool Lexer::SkipBlockComment(Token &Result, const char *CurPtr, in SkipBlockComment() argument
2556 unsigned char C = getCharAndSize(CurPtr, CharSize); in SkipBlockComment()
2557 CurPtr += CharSize; in SkipBlockComment()
2558 if (C == 0 && CurPtr == BufferEnd+1) { in SkipBlockComment()
2561 --CurPtr; in SkipBlockComment()
2566 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipBlockComment()
2570 BufferPtr = CurPtr; in SkipBlockComment()
2577 C = *CurPtr++; in SkipBlockComment()
2582 if (CurPtr + 24 < BufferEnd && in SkipBlockComment()
2587 while (C != '/' && ((intptr_t)CurPtr & 0x0F) != 0) in SkipBlockComment()
2588 C = *CurPtr++; in SkipBlockComment()
2594 while (CurPtr+16 <= BufferEnd) { in SkipBlockComment()
2595 int cmp = _mm_movemask_epi8(_mm_cmpeq_epi8(*(const __m128i*)CurPtr, in SkipBlockComment()
2601 CurPtr += llvm::countTrailingZeros<unsigned>(cmp) + 1; in SkipBlockComment()
2604 CurPtr += 16; in SkipBlockComment()
2611 while (CurPtr + 16 <= BufferEnd && in SkipBlockComment()
2612 !vec_any_eq(*(const __vector unsigned char *)CurPtr, Slashes)) in SkipBlockComment()
2613 CurPtr += 16; in SkipBlockComment()
2616 while (CurPtr[0] != '/' && in SkipBlockComment()
2617 CurPtr[1] != '/' && in SkipBlockComment()
2618 CurPtr[2] != '/' && in SkipBlockComment()
2619 CurPtr[3] != '/' && in SkipBlockComment()
2620 CurPtr+4 < BufferEnd) { in SkipBlockComment()
2621 CurPtr += 4; in SkipBlockComment()
2626 C = *CurPtr++; in SkipBlockComment()
2631 C = *CurPtr++; in SkipBlockComment()
2635 if (CurPtr[-2] == '*') // We found the final */. We're done! in SkipBlockComment()
2638 if ((CurPtr[-2] == '\n' || CurPtr[-2] == '\r')) { in SkipBlockComment()
2639 if (isEndOfBlockCommentWithEscapedNewLine(CurPtr-2, this)) { in SkipBlockComment()
2645 if (CurPtr[0] == '*' && CurPtr[1] != '/') { in SkipBlockComment()
2650 Diag(CurPtr-1, diag::warn_nested_block_comment); in SkipBlockComment()
2652 } else if (C == 0 && CurPtr == BufferEnd+1) { in SkipBlockComment()
2658 --CurPtr; in SkipBlockComment()
2663 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipBlockComment()
2667 BufferPtr = CurPtr; in SkipBlockComment()
2669 } else if (C == '\0' && isCodeCompletionPoint(CurPtr-1)) { in SkipBlockComment()
2675 C = *CurPtr++; in SkipBlockComment()
2681 getSourceLocation(CurPtr)))) { in SkipBlockComment()
2682 BufferPtr = CurPtr; in SkipBlockComment()
2688 FormTokenWithChars(Result, CurPtr, tok::comment); in SkipBlockComment()
2696 if (isHorizontalWhitespace(*CurPtr)) { in SkipBlockComment()
2697 SkipWhitespace(Result, CurPtr+1, TokAtPhysicalStartOfLine); in SkipBlockComment()
2702 BufferPtr = CurPtr; in SkipBlockComment()
2720 const char *CurPtr = BufferPtr; in ReadToEndOfLine() local
2722 char Char = getAndAdvanceChar(CurPtr, Tmp); in ReadToEndOfLine()
2730 if (CurPtr-1 != BufferEnd) { in ReadToEndOfLine()
2731 if (isCodeCompletionPoint(CurPtr-1)) { in ReadToEndOfLine()
2747 assert(CurPtr[-1] == Char && "Trigraphs for newline?"); in ReadToEndOfLine()
2748 BufferPtr = CurPtr-1; in ReadToEndOfLine()
2769 bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) { in LexEndOfFile() argument
2777 FormTokenWithChars(Result, CurPtr, tok::eod); in LexEndOfFile()
2817 if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')) { in LexEndOfFile()
2838 BufferPtr = CurPtr; in LexEndOfFile()
2882 static const char *FindConflictEnd(const char *CurPtr, const char *BufferEnd, in FindConflictEnd() argument
2886 auto RestOfBuffer = StringRef(CurPtr, BufferEnd - CurPtr).substr(TermLen); in FindConflictEnd()
2905 bool Lexer::IsStartOfConflictMarker(const char *CurPtr) { in IsStartOfConflictMarker() argument
2907 if (CurPtr != BufferStart && in IsStartOfConflictMarker()
2908 CurPtr[-1] != '\n' && CurPtr[-1] != '\r') in IsStartOfConflictMarker()
2912 if (!StringRef(CurPtr, BufferEnd - CurPtr).startswith("<<<<<<<") && in IsStartOfConflictMarker()
2913 !StringRef(CurPtr, BufferEnd - CurPtr).startswith(">>>> ")) in IsStartOfConflictMarker()
2921 ConflictMarkerKind Kind = *CurPtr == '<' ? CMK_Normal : CMK_Perforce; in IsStartOfConflictMarker()
2925 if (FindConflictEnd(CurPtr, BufferEnd, Kind)) { in IsStartOfConflictMarker()
2928 Diag(CurPtr, diag::err_conflict_marker); in IsStartOfConflictMarker()
2933 while (*CurPtr != '\r' && *CurPtr != '\n') { in IsStartOfConflictMarker()
2934 assert(CurPtr != BufferEnd && "Didn't find end of line"); in IsStartOfConflictMarker()
2935 ++CurPtr; in IsStartOfConflictMarker()
2937 BufferPtr = CurPtr; in IsStartOfConflictMarker()
2949 bool Lexer::HandleEndOfConflictMarker(const char *CurPtr) { in HandleEndOfConflictMarker() argument
2951 if (CurPtr != BufferStart && in HandleEndOfConflictMarker()
2952 CurPtr[-1] != '\n' && CurPtr[-1] != '\r') in HandleEndOfConflictMarker()
2962 if (CurPtr[i] != CurPtr[0]) in HandleEndOfConflictMarker()
2968 if (const char *End = FindConflictEnd(CurPtr, BufferEnd, in HandleEndOfConflictMarker()
2970 CurPtr = End; in HandleEndOfConflictMarker()
2973 while (CurPtr != BufferEnd && *CurPtr != '\r' && *CurPtr != '\n') in HandleEndOfConflictMarker()
2974 ++CurPtr; in HandleEndOfConflictMarker()
2976 BufferPtr = CurPtr; in HandleEndOfConflictMarker()
2986 static const char *findPlaceholderEnd(const char *CurPtr, in findPlaceholderEnd() argument
2988 if (CurPtr == BufferEnd) in findPlaceholderEnd()
2991 for (; CurPtr != BufferEnd; ++CurPtr) { in findPlaceholderEnd()
2992 if (CurPtr[0] == '#' && CurPtr[1] == '>') in findPlaceholderEnd()
2993 return CurPtr + 2; in findPlaceholderEnd()
2998 bool Lexer::lexEditorPlaceholder(Token &Result, const char *CurPtr) { in lexEditorPlaceholder() argument
2999 assert(CurPtr[-1] == '<' && CurPtr[0] == '#' && "Not a placeholder!"); in lexEditorPlaceholder()
3002 const char *End = findPlaceholderEnd(CurPtr + 1, BufferEnd); in lexEditorPlaceholder()
3005 const char *Start = CurPtr - 1; in lexEditorPlaceholder()
3017 bool Lexer::isCodeCompletionPoint(const char *CurPtr) const { in isCodeCompletionPoint()
3019 SourceLocation Loc = FileLoc.getLocWithOffset(CurPtr-BufferStart); in isCodeCompletionPoint()
3045 const char *CurPtr = StartPtr + CharSize; in tryReadUCN() local
3046 const char *KindLoc = &CurPtr[-1]; in tryReadUCN()
3050 char C = getCharAndSize(CurPtr, CharSize); in tryReadUCN()
3076 CurPtr += CharSize; in tryReadUCN()
3081 if (CurPtr - StartPtr == (ptrdiff_t)NumHexDigits + 2) in tryReadUCN()
3082 StartPtr = CurPtr; in tryReadUCN()
3084 while (StartPtr != CurPtr) in tryReadUCN()
3087 StartPtr = CurPtr; in tryReadUCN()
3138 const char *CurPtr) { in CheckUnicodeWhitespace() argument
3144 << makeCharRange(*this, BufferPtr, CurPtr); in CheckUnicodeWhitespace()
3152 bool Lexer::LexUnicode(Token &Result, uint32_t C, const char *CurPtr) { in LexUnicode() argument
3157 makeCharRange(*this, BufferPtr, CurPtr), in LexUnicode()
3160 makeCharRange(*this, BufferPtr, CurPtr)); in LexUnicode()
3164 return LexIdentifier(Result, CurPtr); in LexUnicode()
3180 << FixItHint::CreateRemoval(makeCharRange(*this, BufferPtr, CurPtr)); in LexUnicode()
3182 BufferPtr = CurPtr; in LexUnicode()
3189 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexUnicode()
3242 const char *CurPtr = BufferPtr; in LexTokenInternal() local
3245 if (isHorizontalWhitespace(*CurPtr)) { in LexTokenInternal()
3247 ++CurPtr; in LexTokenInternal()
3248 } while (isHorizontalWhitespace(*CurPtr)); in LexTokenInternal()
3254 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexTokenInternal()
3259 BufferPtr = CurPtr; in LexTokenInternal()
3266 char Char = getAndAdvanceChar(CurPtr, Result); in LexTokenInternal()
3275 if (CurPtr-1 == BufferEnd) in LexTokenInternal()
3276 return LexEndOfFile(Result, CurPtr-1); in LexTokenInternal()
3279 if (isCodeCompletionPoint(CurPtr-1)) { in LexTokenInternal()
3282 FormTokenWithChars(Result, CurPtr, tok::code_completion); in LexTokenInternal()
3287 Diag(CurPtr-1, diag::null_in_file); in LexTokenInternal()
3289 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3300 Diag(CurPtr-1, diag::ext_ctrl_z_eof_microsoft); in LexTokenInternal()
3301 return LexEndOfFile(Result, CurPtr-1); in LexTokenInternal()
3309 if (CurPtr[0] == '\n') in LexTokenInternal()
3310 (void)getAndAdvanceChar(CurPtr, Result); in LexTokenInternal()
3326 NewLinePtr = CurPtr - 1; in LexTokenInternal()
3335 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3347 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3351 CurPtr = BufferPtr; in LexTokenInternal()
3355 if (CurPtr[0] == '/' && CurPtr[1] == '/' && !inKeepCommentMode() && in LexTokenInternal()
3358 if (SkipLineComment(Result, CurPtr+2, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3361 } else if (CurPtr[0] == '/' && CurPtr[1] == '*' && !inKeepCommentMode()) { in LexTokenInternal()
3362 if (SkipBlockComment(Result, CurPtr+2, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3365 } else if (isHorizontalWhitespace(*CurPtr)) { in LexTokenInternal()
3378 return LexNumericConstant(Result, CurPtr); in LexTokenInternal()
3385 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3389 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3394 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3399 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3401 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3406 char Char2 = getCharAndSize(CurPtr + SizeTmp, SizeTmp2); in LexTokenInternal()
3411 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3416 Result, ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3422 char Char3 = getCharAndSize(CurPtr + SizeTmp + SizeTmp2, SizeTmp3); in LexTokenInternal()
3426 ConsumeChar(ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3436 return LexIdentifier(Result, CurPtr); in LexTokenInternal()
3443 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3447 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3452 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3457 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3459 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3465 return LexIdentifier(Result, CurPtr); in LexTokenInternal()
3472 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3476 ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3481 return LexIdentifier(Result, CurPtr); in LexTokenInternal()
3486 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3490 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3495 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3497 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3503 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3520 return LexIdentifier(Result, CurPtr); in LexTokenInternal()
3525 Diag(CurPtr-1, diag::ext_dollar_in_identifier); in LexTokenInternal()
3528 return LexIdentifier(Result, CurPtr); in LexTokenInternal()
3538 return LexCharConstant(Result, CurPtr, tok::char_constant); in LexTokenInternal()
3544 return LexStringLiteral(Result, CurPtr, in LexTokenInternal()
3571 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3576 return LexNumericConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result)); in LexTokenInternal()
3579 CurPtr += SizeTmp; in LexTokenInternal()
3581 getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '.') { in LexTokenInternal()
3583 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3590 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3593 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3596 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3602 if (getCharAndSize(CurPtr, SizeTmp) == '=') { in LexTokenInternal()
3604 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3610 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3612 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3615 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3622 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3624 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3627 getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '*') { // C++ ->* in LexTokenInternal()
3628 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3632 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3635 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3645 if (getCharAndSize(CurPtr, SizeTmp) == '=') { in LexTokenInternal()
3647 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3654 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3668 TreatAsComment = getCharAndSize(CurPtr+SizeTmp, SizeTmp2) != '*'; in LexTokenInternal()
3671 if (SkipLineComment(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3683 if (SkipBlockComment(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3693 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3700 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3703 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3706 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3708 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3709 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3710 if (Char == '%' && getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == ':') { in LexTokenInternal()
3712 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3715 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3734 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3736 return LexAngledStringLiteral(Result, CurPtr); in LexTokenInternal()
3738 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
3741 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3743 } else if (After == '<' && IsStartOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
3747 } else if (After == '<' && HandleEndOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
3753 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3756 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3760 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
3765 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3775 getSourceLocation(CurPtr + SizeTmp, SizeTmp2), " "); in LexTokenInternal()
3778 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3782 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == ':') { in LexTokenInternal()
3789 char After = getCharAndSize(CurPtr + SizeTmp + SizeTmp2, SizeTmp3); in LexTokenInternal()
3798 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3801 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3804 lexEditorPlaceholder(Result, CurPtr)) { in LexTokenInternal()
3811 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3813 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3816 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
3818 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3821 } else if (After == '>' && IsStartOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
3825 } else if (After == '>' && HandleEndOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
3830 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3833 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3841 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3843 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3846 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3853 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3856 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3859 if (CurPtr[1] == '|' && HandleEndOfConflictMarker(CurPtr-1)) in LexTokenInternal()
3862 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3868 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3871 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3876 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3885 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3888 if (CurPtr[1] == '=' && HandleEndOfConflictMarker(CurPtr-1)) in LexTokenInternal()
3892 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3901 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3904 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3909 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3924 if (CurPtr[-1] == '@' && LangOpts.ObjC) in LexTokenInternal()
3933 if (uint32_t CodePoint = tryReadUCN(CurPtr, BufferPtr, &Result)) { in LexTokenInternal()
3934 if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) { in LexTokenInternal()
3935 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3943 return LexUnicode(Result, CodePoint, CurPtr); in LexTokenInternal()
3960 --CurPtr; in LexTokenInternal()
3962 llvm::convertUTF8Sequence((const llvm::UTF8 **)&CurPtr, in LexTokenInternal()
3967 if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) { in LexTokenInternal()
3968 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3975 return LexUnicode(Result, CodePoint, CurPtr); in LexTokenInternal()
3980 ++CurPtr; in LexTokenInternal()
3988 Diag(CurPtr, diag::err_invalid_utf8); in LexTokenInternal()
3990 BufferPtr = CurPtr+1; in LexTokenInternal()
4002 FormTokenWithChars(Result, CurPtr, Kind); in LexTokenInternal()
4008 FormTokenWithChars(Result, CurPtr, tok::hash); in LexTokenInternal()