Lines Matching refs:CurPtr
592 const char *CurPtr = Buffer.begin(); in ComputePreamble() local
594 while (CurPtr != Buffer.end()) { in ComputePreamble()
595 char ch = *CurPtr++; in ComputePreamble()
602 if (CurPtr != Buffer.end()) in ComputePreamble()
603 MaxLineOffset = CurPtr - Buffer.begin(); in ComputePreamble()
1584 bool Lexer::tryConsumeIdentifierUCN(const char *&CurPtr, unsigned Size, in tryConsumeIdentifierUCN() argument
1586 const char *UCNPtr = CurPtr + Size; in tryConsumeIdentifierUCN()
1587 uint32_t CodePoint = tryReadUCN(UCNPtr, CurPtr, /*Token=*/nullptr); in tryConsumeIdentifierUCN()
1593 makeCharRange(*this, CurPtr, UCNPtr), in tryConsumeIdentifierUCN()
1597 if ((UCNPtr - CurPtr == 6 && CurPtr[1] == 'u') || in tryConsumeIdentifierUCN()
1598 (UCNPtr - CurPtr == 10 && CurPtr[1] == 'U')) in tryConsumeIdentifierUCN()
1599 CurPtr = UCNPtr; in tryConsumeIdentifierUCN()
1601 while (CurPtr != UCNPtr) in tryConsumeIdentifierUCN()
1602 (void)getAndAdvanceChar(CurPtr, Result); in tryConsumeIdentifierUCN()
1606 bool Lexer::tryConsumeIdentifierUTF8Char(const char *&CurPtr) { in tryConsumeIdentifierUTF8Char() argument
1607 const char *UnicodePtr = CurPtr; in tryConsumeIdentifierUTF8Char()
1620 makeCharRange(*this, CurPtr, UnicodePtr), in tryConsumeIdentifierUTF8Char()
1623 makeCharRange(*this, CurPtr, UnicodePtr)); in tryConsumeIdentifierUTF8Char()
1626 CurPtr = UnicodePtr; in tryConsumeIdentifierUTF8Char()
1630 bool Lexer::LexIdentifier(Token &Result, const char *CurPtr) { in LexIdentifier() argument
1633 unsigned char C = *CurPtr++; in LexIdentifier()
1635 C = *CurPtr++; in LexIdentifier()
1637 --CurPtr; // Back up over the skipped character. in LexIdentifier()
1648 FormTokenWithChars(Result, CurPtr, tok::raw_identifier); in LexIdentifier()
1665 if (isCodeCompletionPoint(CurPtr)) { in LexIdentifier()
1673 assert(*CurPtr == 0 && "Completion character must be 0"); in LexIdentifier()
1674 ++CurPtr; in LexIdentifier()
1678 if (CurPtr < BufferEnd) { in LexIdentifier()
1679 while (isIdentifierBody(*CurPtr)) in LexIdentifier()
1680 ++CurPtr; in LexIdentifier()
1682 BufferPtr = CurPtr; in LexIdentifier()
1696 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1704 Diag(CurPtr, diag::ext_dollar_in_identifier); in LexIdentifier()
1705 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexIdentifier()
1706 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1708 } else if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) { in LexIdentifier()
1709 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1711 } else if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) { in LexIdentifier()
1712 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1719 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexIdentifier()
1721 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1723 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexIdentifier()
1724 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1743 bool Lexer::LexNumericConstant(Token &Result, const char *CurPtr) { in LexNumericConstant() argument
1745 char C = getCharAndSize(CurPtr, Size); in LexNumericConstant()
1748 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexNumericConstant()
1750 C = getCharAndSize(CurPtr, Size); in LexNumericConstant()
1758 return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); in LexNumericConstant()
1771 std::find(BufferPtr, CurPtr, '_') != CurPtr) in LexNumericConstant()
1775 return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); in LexNumericConstant()
1781 char Next = getCharAndSizeNoWarn(CurPtr + Size, NextSize, getLangOpts()); in LexNumericConstant()
1784 Diag(CurPtr, diag::warn_cxx11_compat_digit_separator); in LexNumericConstant()
1785 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexNumericConstant()
1786 CurPtr = ConsumeChar(CurPtr, NextSize, Result); in LexNumericConstant()
1787 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
1792 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) in LexNumericConstant()
1793 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
1794 if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) in LexNumericConstant()
1795 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
1799 FormTokenWithChars(Result, CurPtr, tok::numeric_constant); in LexNumericConstant()
1806 const char *Lexer::LexUDSuffix(Token &Result, const char *CurPtr, in LexUDSuffix() argument
1812 char C = getCharAndSize(CurPtr, Size); in LexUDSuffix()
1816 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) in LexUDSuffix()
1818 else if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) in LexUDSuffix()
1821 return CurPtr; in LexUDSuffix()
1826 Diag(CurPtr, in LexUDSuffix()
1829 << FixItHint::CreateInsertion(getSourceLocation(CurPtr), " "); in LexUDSuffix()
1830 return CurPtr; in LexUDSuffix()
1852 char Next = getCharAndSizeNoWarn(CurPtr + Consumed, NextSize, in LexUDSuffix()
1873 Diag(CurPtr, getLangOpts().MSVCCompat in LexUDSuffix()
1876 << FixItHint::CreateInsertion(getSourceLocation(CurPtr), " "); in LexUDSuffix()
1877 return CurPtr; in LexUDSuffix()
1880 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexUDSuffix()
1885 C = getCharAndSize(CurPtr, Size); in LexUDSuffix()
1886 if (isIdentifierBody(C)) { CurPtr = ConsumeChar(CurPtr, Size, Result); } in LexUDSuffix()
1887 else if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) {} in LexUDSuffix()
1888 else if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) {} in LexUDSuffix()
1892 return CurPtr; in LexUDSuffix()
1897 bool Lexer::LexStringLiteral(Token &Result, const char *CurPtr, in LexStringLiteral() argument
1899 const char *AfterQuote = CurPtr; in LexStringLiteral()
1911 char C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
1916 C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
1919 (C == 0 && CurPtr-1 == BufferEnd)) { // End of file. in LexStringLiteral()
1922 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexStringLiteral()
1927 if (isCodeCompletionPoint(CurPtr-1)) { in LexStringLiteral()
1929 codeCompleteIncludedFile(AfterQuote, CurPtr - 1, /*IsAngled=*/false); in LexStringLiteral()
1932 FormTokenWithChars(Result, CurPtr - 1, tok::unknown); in LexStringLiteral()
1937 NulCharacter = CurPtr-1; in LexStringLiteral()
1939 C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
1944 CurPtr = LexUDSuffix(Result, CurPtr, true); in LexStringLiteral()
1952 FormTokenWithChars(Result, CurPtr, Kind); in LexStringLiteral()
1959 bool Lexer::LexRawStringLiteral(Token &Result, const char *CurPtr, in LexRawStringLiteral() argument
1971 while (PrefixLen != 16 && isRawStringDelimBody(CurPtr[PrefixLen])) in LexRawStringLiteral()
1975 if (CurPtr[PrefixLen] != '(') { in LexRawStringLiteral()
1977 const char *PrefixEnd = &CurPtr[PrefixLen]; in LexRawStringLiteral()
1990 char C = *CurPtr++; in LexRawStringLiteral()
1994 if (C == 0 && CurPtr-1 == BufferEnd) { in LexRawStringLiteral()
1995 --CurPtr; in LexRawStringLiteral()
2000 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexRawStringLiteral()
2005 const char *Prefix = CurPtr; in LexRawStringLiteral()
2006 CurPtr += PrefixLen + 1; // skip over prefix and '(' in LexRawStringLiteral()
2009 char C = *CurPtr++; in LexRawStringLiteral()
2013 if (strncmp(CurPtr, Prefix, PrefixLen) == 0 && CurPtr[PrefixLen] == '"') { in LexRawStringLiteral()
2014 CurPtr += PrefixLen + 1; // skip over prefix and '"' in LexRawStringLiteral()
2017 } else if (C == 0 && CurPtr-1 == BufferEnd) { // End of file. in LexRawStringLiteral()
2021 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexRawStringLiteral()
2028 CurPtr = LexUDSuffix(Result, CurPtr, true); in LexRawStringLiteral()
2032 FormTokenWithChars(Result, CurPtr, Kind); in LexRawStringLiteral()
2039 bool Lexer::LexAngledStringLiteral(Token &Result, const char *CurPtr) { in LexAngledStringLiteral() argument
2042 const char *AfterLessPos = CurPtr; in LexAngledStringLiteral()
2043 char C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2048 C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2051 (C == 0 && (CurPtr - 1 == BufferEnd))) { // End of file. in LexAngledStringLiteral()
2059 if (isCodeCompletionPoint(CurPtr - 1)) { in LexAngledStringLiteral()
2060 codeCompleteIncludedFile(AfterLessPos, CurPtr - 1, /*IsAngled=*/true); in LexAngledStringLiteral()
2062 FormTokenWithChars(Result, CurPtr - 1, tok::unknown); in LexAngledStringLiteral()
2065 NulCharacter = CurPtr-1; in LexAngledStringLiteral()
2067 C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2076 FormTokenWithChars(Result, CurPtr, tok::angle_string_literal); in LexAngledStringLiteral()
2111 bool Lexer::LexCharConstant(Token &Result, const char *CurPtr, in LexCharConstant() argument
2125 char C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2129 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexCharConstant()
2136 C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2139 (C == 0 && CurPtr-1 == BufferEnd)) { // End of file. in LexCharConstant()
2142 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexCharConstant()
2147 if (isCodeCompletionPoint(CurPtr-1)) { in LexCharConstant()
2149 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexCharConstant()
2154 NulCharacter = CurPtr-1; in LexCharConstant()
2156 C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2161 CurPtr = LexUDSuffix(Result, CurPtr, false); in LexCharConstant()
2169 FormTokenWithChars(Result, CurPtr, Kind); in LexCharConstant()
2178 bool Lexer::SkipWhitespace(Token &Result, const char *CurPtr, in SkipWhitespace() argument
2181 bool SawNewline = isVerticalWhitespace(CurPtr[-1]); in SkipWhitespace()
2183 unsigned char Char = *CurPtr; in SkipWhitespace()
2189 Char = *++CurPtr; in SkipWhitespace()
2197 BufferPtr = CurPtr; in SkipWhitespace()
2203 Char = *++CurPtr; in SkipWhitespace()
2208 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipWhitespace()
2218 char PrevChar = CurPtr[-1]; in SkipWhitespace()
2227 BufferPtr = CurPtr; in SkipWhitespace()
2237 bool Lexer::SkipLineComment(Token &Result, const char *CurPtr, in SkipLineComment() argument
2257 C = *CurPtr; in SkipLineComment()
2261 C = *++CurPtr; in SkipLineComment()
2263 const char *NextLine = CurPtr; in SkipLineComment()
2266 const char *EscapePtr = CurPtr-1; in SkipLineComment()
2275 CurPtr = EscapePtr; in SkipLineComment()
2279 CurPtr = EscapePtr-2; in SkipLineComment()
2292 const char *OldPtr = CurPtr; in SkipLineComment()
2295 C = getAndAdvanceChar(CurPtr, Result); in SkipLineComment()
2300 if (C != 0 && CurPtr == OldPtr+1) { in SkipLineComment()
2301 CurPtr = NextLine; in SkipLineComment()
2308 if (CurPtr != OldPtr + 1 && C != '/' && in SkipLineComment()
2309 (CurPtr == BufferEnd + 1 || CurPtr[0] != '/')) { in SkipLineComment()
2310 for (; OldPtr != CurPtr; ++OldPtr) in SkipLineComment()
2315 const char *ForwardPtr = CurPtr; in SkipLineComment()
2328 if (C == '\r' || C == '\n' || CurPtr == BufferEnd + 1) { in SkipLineComment()
2329 --CurPtr; in SkipLineComment()
2333 if (C == '\0' && isCodeCompletionPoint(CurPtr-1)) { in SkipLineComment()
2344 getSourceLocation(CurPtr)))) { in SkipLineComment()
2345 BufferPtr = CurPtr; in SkipLineComment()
2351 return SaveLineComment(Result, CurPtr); in SkipLineComment()
2355 if (ParsingPreprocessorDirective || CurPtr == BufferEnd) { in SkipLineComment()
2356 BufferPtr = CurPtr; in SkipLineComment()
2365 ++CurPtr; in SkipLineComment()
2372 BufferPtr = CurPtr; in SkipLineComment()
2378 bool Lexer::SaveLineComment(Token &Result, const char *CurPtr) { in SaveLineComment() argument
2381 FormTokenWithChars(Result, CurPtr, tok::comment); in SaveLineComment()
2406 static bool isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr, in isEndOfBlockCommentWithEscapedNewLine() argument
2408 assert(CurPtr[0] == '\n' || CurPtr[0] == '\r'); in isEndOfBlockCommentWithEscapedNewLine()
2411 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2414 if (CurPtr[0] == '\n' || CurPtr[0] == '\r') { in isEndOfBlockCommentWithEscapedNewLine()
2416 if (CurPtr[0] == CurPtr[1]) in isEndOfBlockCommentWithEscapedNewLine()
2419 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2425 while (isHorizontalWhitespace(*CurPtr) || *CurPtr == 0) { in isEndOfBlockCommentWithEscapedNewLine()
2426 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2431 if (*CurPtr == '\\') { in isEndOfBlockCommentWithEscapedNewLine()
2432 if (CurPtr[-1] != '*') return false; in isEndOfBlockCommentWithEscapedNewLine()
2435 if (CurPtr[0] != '/' || CurPtr[-1] != '?' || CurPtr[-2] != '?' || in isEndOfBlockCommentWithEscapedNewLine()
2436 CurPtr[-3] != '*') in isEndOfBlockCommentWithEscapedNewLine()
2440 CurPtr -= 2; in isEndOfBlockCommentWithEscapedNewLine()
2446 L->Diag(CurPtr, diag::trigraph_ignored_block_comment); in isEndOfBlockCommentWithEscapedNewLine()
2450 L->Diag(CurPtr, diag::trigraph_ends_block_comment); in isEndOfBlockCommentWithEscapedNewLine()
2455 L->Diag(CurPtr, diag::escaped_newline_block_comment_end); in isEndOfBlockCommentWithEscapedNewLine()
2459 L->Diag(CurPtr, diag::backslash_newline_space); in isEndOfBlockCommentWithEscapedNewLine()
2480 bool Lexer::SkipBlockComment(Token &Result, const char *CurPtr, in SkipBlockComment() argument
2491 unsigned char C = getCharAndSize(CurPtr, CharSize); in SkipBlockComment()
2492 CurPtr += CharSize; in SkipBlockComment()
2493 if (C == 0 && CurPtr == BufferEnd+1) { in SkipBlockComment()
2496 --CurPtr; in SkipBlockComment()
2501 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipBlockComment()
2505 BufferPtr = CurPtr; in SkipBlockComment()
2512 C = *CurPtr++; in SkipBlockComment()
2517 if (CurPtr + 24 < BufferEnd && in SkipBlockComment()
2522 while (C != '/' && ((intptr_t)CurPtr & 0x0F) != 0) in SkipBlockComment()
2523 C = *CurPtr++; in SkipBlockComment()
2529 while (CurPtr+16 <= BufferEnd) { in SkipBlockComment()
2530 int cmp = _mm_movemask_epi8(_mm_cmpeq_epi8(*(const __m128i*)CurPtr, in SkipBlockComment()
2536 CurPtr += llvm::countTrailingZeros<unsigned>(cmp) + 1; in SkipBlockComment()
2539 CurPtr += 16; in SkipBlockComment()
2546 while (CurPtr+16 <= BufferEnd && in SkipBlockComment()
2547 !vec_any_eq(*(const vector unsigned char*)CurPtr, Slashes)) in SkipBlockComment()
2548 CurPtr += 16; in SkipBlockComment()
2551 while (CurPtr[0] != '/' && in SkipBlockComment()
2552 CurPtr[1] != '/' && in SkipBlockComment()
2553 CurPtr[2] != '/' && in SkipBlockComment()
2554 CurPtr[3] != '/' && in SkipBlockComment()
2555 CurPtr+4 < BufferEnd) { in SkipBlockComment()
2556 CurPtr += 4; in SkipBlockComment()
2561 C = *CurPtr++; in SkipBlockComment()
2566 C = *CurPtr++; in SkipBlockComment()
2570 if (CurPtr[-2] == '*') // We found the final */. We're done! in SkipBlockComment()
2573 if ((CurPtr[-2] == '\n' || CurPtr[-2] == '\r')) { in SkipBlockComment()
2574 if (isEndOfBlockCommentWithEscapedNewLine(CurPtr-2, this)) { in SkipBlockComment()
2580 if (CurPtr[0] == '*' && CurPtr[1] != '/') { in SkipBlockComment()
2585 Diag(CurPtr-1, diag::warn_nested_block_comment); in SkipBlockComment()
2587 } else if (C == 0 && CurPtr == BufferEnd+1) { in SkipBlockComment()
2593 --CurPtr; in SkipBlockComment()
2598 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipBlockComment()
2602 BufferPtr = CurPtr; in SkipBlockComment()
2604 } else if (C == '\0' && isCodeCompletionPoint(CurPtr-1)) { in SkipBlockComment()
2610 C = *CurPtr++; in SkipBlockComment()
2616 getSourceLocation(CurPtr)))) { in SkipBlockComment()
2617 BufferPtr = CurPtr; in SkipBlockComment()
2623 FormTokenWithChars(Result, CurPtr, tok::comment); in SkipBlockComment()
2631 if (isHorizontalWhitespace(*CurPtr)) { in SkipBlockComment()
2632 SkipWhitespace(Result, CurPtr+1, TokAtPhysicalStartOfLine); in SkipBlockComment()
2637 BufferPtr = CurPtr; in SkipBlockComment()
2654 const char *CurPtr = BufferPtr; in ReadToEndOfLine() local
2656 char Char = getAndAdvanceChar(CurPtr, Tmp); in ReadToEndOfLine()
2664 if (CurPtr-1 != BufferEnd) { in ReadToEndOfLine()
2665 if (isCodeCompletionPoint(CurPtr-1)) { in ReadToEndOfLine()
2681 assert(CurPtr[-1] == Char && "Trigraphs for newline?"); in ReadToEndOfLine()
2682 BufferPtr = CurPtr-1; in ReadToEndOfLine()
2703 bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) { in LexEndOfFile() argument
2711 FormTokenWithChars(Result, CurPtr, tok::eod); in LexEndOfFile()
2745 if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')) { in LexEndOfFile()
2767 BufferPtr = CurPtr; in LexEndOfFile()
2811 static const char *FindConflictEnd(const char *CurPtr, const char *BufferEnd, in FindConflictEnd() argument
2815 auto RestOfBuffer = StringRef(CurPtr, BufferEnd - CurPtr).substr(TermLen); in FindConflictEnd()
2834 bool Lexer::IsStartOfConflictMarker(const char *CurPtr) { in IsStartOfConflictMarker() argument
2836 if (CurPtr != BufferStart && in IsStartOfConflictMarker()
2837 CurPtr[-1] != '\n' && CurPtr[-1] != '\r') in IsStartOfConflictMarker()
2841 if (!StringRef(CurPtr, BufferEnd - CurPtr).startswith("<<<<<<<") && in IsStartOfConflictMarker()
2842 !StringRef(CurPtr, BufferEnd - CurPtr).startswith(">>>> ")) in IsStartOfConflictMarker()
2850 ConflictMarkerKind Kind = *CurPtr == '<' ? CMK_Normal : CMK_Perforce; in IsStartOfConflictMarker()
2854 if (FindConflictEnd(CurPtr, BufferEnd, Kind)) { in IsStartOfConflictMarker()
2857 Diag(CurPtr, diag::err_conflict_marker); in IsStartOfConflictMarker()
2862 while (*CurPtr != '\r' && *CurPtr != '\n') { in IsStartOfConflictMarker()
2863 assert(CurPtr != BufferEnd && "Didn't find end of line"); in IsStartOfConflictMarker()
2864 ++CurPtr; in IsStartOfConflictMarker()
2866 BufferPtr = CurPtr; in IsStartOfConflictMarker()
2878 bool Lexer::HandleEndOfConflictMarker(const char *CurPtr) { in HandleEndOfConflictMarker() argument
2880 if (CurPtr != BufferStart && in HandleEndOfConflictMarker()
2881 CurPtr[-1] != '\n' && CurPtr[-1] != '\r') in HandleEndOfConflictMarker()
2891 if (CurPtr[i] != CurPtr[0]) in HandleEndOfConflictMarker()
2897 if (const char *End = FindConflictEnd(CurPtr, BufferEnd, in HandleEndOfConflictMarker()
2899 CurPtr = End; in HandleEndOfConflictMarker()
2902 while (CurPtr != BufferEnd && *CurPtr != '\r' && *CurPtr != '\n') in HandleEndOfConflictMarker()
2903 ++CurPtr; in HandleEndOfConflictMarker()
2905 BufferPtr = CurPtr; in HandleEndOfConflictMarker()
2915 static const char *findPlaceholderEnd(const char *CurPtr, in findPlaceholderEnd() argument
2917 if (CurPtr == BufferEnd) in findPlaceholderEnd()
2920 for (; CurPtr != BufferEnd; ++CurPtr) { in findPlaceholderEnd()
2921 if (CurPtr[0] == '#' && CurPtr[1] == '>') in findPlaceholderEnd()
2922 return CurPtr + 2; in findPlaceholderEnd()
2927 bool Lexer::lexEditorPlaceholder(Token &Result, const char *CurPtr) { in lexEditorPlaceholder() argument
2928 assert(CurPtr[-1] == '<' && CurPtr[0] == '#' && "Not a placeholder!"); in lexEditorPlaceholder()
2931 const char *End = findPlaceholderEnd(CurPtr + 1, BufferEnd); in lexEditorPlaceholder()
2934 const char *Start = CurPtr - 1; in lexEditorPlaceholder()
2946 bool Lexer::isCodeCompletionPoint(const char *CurPtr) const { in isCodeCompletionPoint()
2948 SourceLocation Loc = FileLoc.getLocWithOffset(CurPtr-BufferStart); in isCodeCompletionPoint()
2974 const char *CurPtr = StartPtr + CharSize; in tryReadUCN() local
2975 const char *KindLoc = &CurPtr[-1]; in tryReadUCN()
2979 char C = getCharAndSize(CurPtr, CharSize); in tryReadUCN()
3005 CurPtr += CharSize; in tryReadUCN()
3010 if (CurPtr - StartPtr == (ptrdiff_t)NumHexDigits + 2) in tryReadUCN()
3011 StartPtr = CurPtr; in tryReadUCN()
3013 while (StartPtr != CurPtr) in tryReadUCN()
3016 StartPtr = CurPtr; in tryReadUCN()
3067 const char *CurPtr) { in CheckUnicodeWhitespace() argument
3073 << makeCharRange(*this, BufferPtr, CurPtr); in CheckUnicodeWhitespace()
3081 bool Lexer::LexUnicode(Token &Result, uint32_t C, const char *CurPtr) { in LexUnicode() argument
3086 makeCharRange(*this, BufferPtr, CurPtr), in LexUnicode()
3089 makeCharRange(*this, BufferPtr, CurPtr)); in LexUnicode()
3093 return LexIdentifier(Result, CurPtr); in LexUnicode()
3109 << FixItHint::CreateRemoval(makeCharRange(*this, BufferPtr, CurPtr)); in LexUnicode()
3111 BufferPtr = CurPtr; in LexUnicode()
3118 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexUnicode()
3171 const char *CurPtr = BufferPtr; in LexTokenInternal() local
3174 if ((*CurPtr == ' ') || (*CurPtr == '\t')) { in LexTokenInternal()
3175 ++CurPtr; in LexTokenInternal()
3176 while ((*CurPtr == ' ') || (*CurPtr == '\t')) in LexTokenInternal()
3177 ++CurPtr; in LexTokenInternal()
3183 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexTokenInternal()
3188 BufferPtr = CurPtr; in LexTokenInternal()
3195 char Char = getAndAdvanceChar(CurPtr, Result); in LexTokenInternal()
3201 if (CurPtr-1 == BufferEnd) in LexTokenInternal()
3202 return LexEndOfFile(Result, CurPtr-1); in LexTokenInternal()
3205 if (isCodeCompletionPoint(CurPtr-1)) { in LexTokenInternal()
3208 FormTokenWithChars(Result, CurPtr, tok::code_completion); in LexTokenInternal()
3213 Diag(CurPtr-1, diag::null_in_file); in LexTokenInternal()
3215 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3226 Diag(CurPtr-1, diag::ext_ctrl_z_eof_microsoft); in LexTokenInternal()
3227 return LexEndOfFile(Result, CurPtr-1); in LexTokenInternal()
3235 if (CurPtr[0] == '\n') in LexTokenInternal()
3236 Char = getAndAdvanceChar(CurPtr, Result); in LexTokenInternal()
3260 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3272 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3276 CurPtr = BufferPtr; in LexTokenInternal()
3280 if (CurPtr[0] == '/' && CurPtr[1] == '/' && !inKeepCommentMode() && in LexTokenInternal()
3283 if (SkipLineComment(Result, CurPtr+2, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3286 } else if (CurPtr[0] == '/' && CurPtr[1] == '*' && !inKeepCommentMode()) { in LexTokenInternal()
3287 if (SkipBlockComment(Result, CurPtr+2, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3290 } else if (isHorizontalWhitespace(*CurPtr)) { in LexTokenInternal()
3303 return LexNumericConstant(Result, CurPtr); in LexTokenInternal()
3310 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3314 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3319 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3324 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3326 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3331 char Char2 = getCharAndSize(CurPtr + SizeTmp, SizeTmp2); in LexTokenInternal()
3336 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3341 Result, ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3347 char Char3 = getCharAndSize(CurPtr + SizeTmp + SizeTmp2, SizeTmp3); in LexTokenInternal()
3351 ConsumeChar(ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3361 return LexIdentifier(Result, CurPtr); in LexTokenInternal()
3368 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3372 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3377 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3382 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3384 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3390 return LexIdentifier(Result, CurPtr); in LexTokenInternal()
3397 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3401 ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3406 return LexIdentifier(Result, CurPtr); in LexTokenInternal()
3411 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3415 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3420 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3422 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3428 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3445 return LexIdentifier(Result, CurPtr); in LexTokenInternal()
3450 Diag(CurPtr-1, diag::ext_dollar_in_identifier); in LexTokenInternal()
3453 return LexIdentifier(Result, CurPtr); in LexTokenInternal()
3463 return LexCharConstant(Result, CurPtr, tok::char_constant); in LexTokenInternal()
3469 return LexStringLiteral(Result, CurPtr, tok::string_literal); in LexTokenInternal()
3494 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3499 return LexNumericConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result)); in LexTokenInternal()
3502 CurPtr += SizeTmp; in LexTokenInternal()
3504 getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '.') { in LexTokenInternal()
3506 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3513 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3516 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3519 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3525 if (getCharAndSize(CurPtr, SizeTmp) == '=') { in LexTokenInternal()
3527 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3533 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3535 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3538 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3545 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3547 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3550 getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '*') { // C++ ->* in LexTokenInternal()
3551 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3555 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3558 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3568 if (getCharAndSize(CurPtr, SizeTmp) == '=') { in LexTokenInternal()
3570 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3577 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3591 TreatAsComment = getCharAndSize(CurPtr+SizeTmp, SizeTmp2) != '*'; in LexTokenInternal()
3594 if (SkipLineComment(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3606 if (SkipBlockComment(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3616 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3623 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3626 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3629 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3631 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3632 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3633 if (Char == '%' && getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == ':') { in LexTokenInternal()
3635 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3638 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3657 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3659 return LexAngledStringLiteral(Result, CurPtr); in LexTokenInternal()
3661 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
3664 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3666 } else if (After == '<' && IsStartOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
3670 } else if (After == '<' && HandleEndOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
3676 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3679 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3683 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
3688 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3698 getSourceLocation(CurPtr + SizeTmp, SizeTmp2), " "); in LexTokenInternal()
3701 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3705 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == ':') { in LexTokenInternal()
3712 char After = getCharAndSize(CurPtr + SizeTmp + SizeTmp2, SizeTmp3); in LexTokenInternal()
3721 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3724 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3727 lexEditorPlaceholder(Result, CurPtr)) { in LexTokenInternal()
3734 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3736 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3739 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
3741 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3744 } else if (After == '>' && IsStartOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
3748 } 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()
3764 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3766 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3769 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3776 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3779 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3782 if (CurPtr[1] == '|' && HandleEndOfConflictMarker(CurPtr-1)) in LexTokenInternal()
3785 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3791 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3794 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3799 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3808 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3811 if (CurPtr[1] == '=' && HandleEndOfConflictMarker(CurPtr-1)) in LexTokenInternal()
3815 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3824 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3827 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3832 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3847 if (CurPtr[-1] == '@' && LangOpts.ObjC) in LexTokenInternal()
3856 if (uint32_t CodePoint = tryReadUCN(CurPtr, BufferPtr, &Result)) { in LexTokenInternal()
3857 if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) { in LexTokenInternal()
3858 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3866 return LexUnicode(Result, CodePoint, CurPtr); in LexTokenInternal()
3883 --CurPtr; in LexTokenInternal()
3885 llvm::convertUTF8Sequence((const llvm::UTF8 **)&CurPtr, in LexTokenInternal()
3890 if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) { in LexTokenInternal()
3891 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3898 return LexUnicode(Result, CodePoint, CurPtr); in LexTokenInternal()
3903 ++CurPtr; in LexTokenInternal()
3911 Diag(CurPtr, diag::err_invalid_utf8); in LexTokenInternal()
3913 BufferPtr = CurPtr+1; in LexTokenInternal()
3925 FormTokenWithChars(Result, CurPtr, Kind); in LexTokenInternal()
3931 FormTokenWithChars(Result, CurPtr, tok::hash); in LexTokenInternal()