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()
1596 bool Lexer::tryConsumeIdentifierUCN(const char *&CurPtr, unsigned Size, in tryConsumeIdentifierUCN() argument
1598 const char *UCNPtr = CurPtr + Size; in tryConsumeIdentifierUCN()
1599 uint32_t CodePoint = tryReadUCN(UCNPtr, CurPtr, /*Token=*/nullptr); in tryConsumeIdentifierUCN()
1605 makeCharRange(*this, CurPtr, UCNPtr), in tryConsumeIdentifierUCN()
1609 if ((UCNPtr - CurPtr == 6 && CurPtr[1] == 'u') || in tryConsumeIdentifierUCN()
1610 (UCNPtr - CurPtr == 10 && CurPtr[1] == 'U')) in tryConsumeIdentifierUCN()
1611 CurPtr = UCNPtr; in tryConsumeIdentifierUCN()
1613 while (CurPtr != UCNPtr) in tryConsumeIdentifierUCN()
1614 (void)getAndAdvanceChar(CurPtr, Result); in tryConsumeIdentifierUCN()
1618 bool Lexer::tryConsumeIdentifierUTF8Char(const char *&CurPtr) { in tryConsumeIdentifierUTF8Char() argument
1619 const char *UnicodePtr = CurPtr; in tryConsumeIdentifierUTF8Char()
1632 makeCharRange(*this, CurPtr, UnicodePtr), in tryConsumeIdentifierUTF8Char()
1635 makeCharRange(*this, CurPtr, UnicodePtr)); in tryConsumeIdentifierUTF8Char()
1638 CurPtr = UnicodePtr; in tryConsumeIdentifierUTF8Char()
1642 bool Lexer::LexIdentifier(Token &Result, const char *CurPtr) { in LexIdentifier() argument
1645 unsigned char C = *CurPtr++; in LexIdentifier()
1647 C = *CurPtr++; in LexIdentifier()
1649 --CurPtr; // Back up over the skipped character. in LexIdentifier()
1660 FormTokenWithChars(Result, CurPtr, tok::raw_identifier); in LexIdentifier()
1677 if (isCodeCompletionPoint(CurPtr)) { in LexIdentifier()
1685 assert(*CurPtr == 0 && "Completion character must be 0"); in LexIdentifier()
1686 ++CurPtr; in LexIdentifier()
1690 if (CurPtr < BufferEnd) { in LexIdentifier()
1691 while (isIdentifierBody(*CurPtr)) in LexIdentifier()
1692 ++CurPtr; in LexIdentifier()
1694 BufferPtr = CurPtr; in LexIdentifier()
1708 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1716 Diag(CurPtr, diag::ext_dollar_in_identifier); in LexIdentifier()
1717 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexIdentifier()
1718 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1720 } else if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) { in LexIdentifier()
1721 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1723 } else if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) { in LexIdentifier()
1724 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1731 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexIdentifier()
1733 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1735 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexIdentifier()
1736 C = getCharAndSize(CurPtr, Size); in LexIdentifier()
1755 bool Lexer::LexNumericConstant(Token &Result, const char *CurPtr) { in LexNumericConstant() argument
1757 char C = getCharAndSize(CurPtr, Size); in LexNumericConstant()
1760 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexNumericConstant()
1762 C = getCharAndSize(CurPtr, Size); in LexNumericConstant()
1770 return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); in LexNumericConstant()
1783 std::find(BufferPtr, CurPtr, '_') != CurPtr) in LexNumericConstant()
1787 return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); in LexNumericConstant()
1793 char Next = getCharAndSizeNoWarn(CurPtr + Size, NextSize, getLangOpts()); in LexNumericConstant()
1796 Diag(CurPtr, getLangOpts().CPlusPlus in LexNumericConstant()
1799 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexNumericConstant()
1800 CurPtr = ConsumeChar(CurPtr, NextSize, Result); in LexNumericConstant()
1801 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
1806 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) in LexNumericConstant()
1807 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
1808 if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) in LexNumericConstant()
1809 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
1813 FormTokenWithChars(Result, CurPtr, tok::numeric_constant); in LexNumericConstant()
1820 const char *Lexer::LexUDSuffix(Token &Result, const char *CurPtr, in LexUDSuffix() argument
1826 char C = getCharAndSize(CurPtr, Size); in LexUDSuffix()
1830 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) in LexUDSuffix()
1832 else if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) in LexUDSuffix()
1835 return CurPtr; in LexUDSuffix()
1840 Diag(CurPtr, in LexUDSuffix()
1843 << FixItHint::CreateInsertion(getSourceLocation(CurPtr), " "); in LexUDSuffix()
1844 return CurPtr; in LexUDSuffix()
1866 char Next = getCharAndSizeNoWarn(CurPtr + Consumed, NextSize, in LexUDSuffix()
1887 Diag(CurPtr, getLangOpts().MSVCCompat in LexUDSuffix()
1890 << FixItHint::CreateInsertion(getSourceLocation(CurPtr), " "); in LexUDSuffix()
1891 return CurPtr; in LexUDSuffix()
1894 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexUDSuffix()
1899 C = getCharAndSize(CurPtr, Size); in LexUDSuffix()
1900 if (isIdentifierBody(C)) { CurPtr = ConsumeChar(CurPtr, Size, Result); } in LexUDSuffix()
1901 else if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) {} in LexUDSuffix()
1902 else if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) {} in LexUDSuffix()
1906 return CurPtr; in LexUDSuffix()
1911 bool Lexer::LexStringLiteral(Token &Result, const char *CurPtr, in LexStringLiteral() argument
1913 const char *AfterQuote = CurPtr; in LexStringLiteral()
1925 char C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
1930 C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
1933 (C == 0 && CurPtr-1 == BufferEnd)) { // End of file. in LexStringLiteral()
1936 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexStringLiteral()
1941 if (isCodeCompletionPoint(CurPtr-1)) { in LexStringLiteral()
1943 codeCompleteIncludedFile(AfterQuote, CurPtr - 1, /*IsAngled=*/false); in LexStringLiteral()
1946 FormTokenWithChars(Result, CurPtr - 1, tok::unknown); in LexStringLiteral()
1951 NulCharacter = CurPtr-1; in LexStringLiteral()
1953 C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
1958 CurPtr = LexUDSuffix(Result, CurPtr, true); in LexStringLiteral()
1966 FormTokenWithChars(Result, CurPtr, Kind); in LexStringLiteral()
1973 bool Lexer::LexRawStringLiteral(Token &Result, const char *CurPtr, in LexRawStringLiteral() argument
1985 while (PrefixLen != 16 && isRawStringDelimBody(CurPtr[PrefixLen])) in LexRawStringLiteral()
1989 if (CurPtr[PrefixLen] != '(') { in LexRawStringLiteral()
1991 const char *PrefixEnd = &CurPtr[PrefixLen]; in LexRawStringLiteral()
2004 char C = *CurPtr++; in LexRawStringLiteral()
2008 if (C == 0 && CurPtr-1 == BufferEnd) { in LexRawStringLiteral()
2009 --CurPtr; in LexRawStringLiteral()
2014 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexRawStringLiteral()
2019 const char *Prefix = CurPtr; in LexRawStringLiteral()
2020 CurPtr += PrefixLen + 1; // skip over prefix and '(' in LexRawStringLiteral()
2023 char C = *CurPtr++; in LexRawStringLiteral()
2027 if (strncmp(CurPtr, Prefix, PrefixLen) == 0 && CurPtr[PrefixLen] == '"') { in LexRawStringLiteral()
2028 CurPtr += PrefixLen + 1; // skip over prefix and '"' in LexRawStringLiteral()
2031 } else if (C == 0 && CurPtr-1 == BufferEnd) { // End of file. in LexRawStringLiteral()
2035 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexRawStringLiteral()
2042 CurPtr = LexUDSuffix(Result, CurPtr, true); in LexRawStringLiteral()
2046 FormTokenWithChars(Result, CurPtr, Kind); in LexRawStringLiteral()
2053 bool Lexer::LexAngledStringLiteral(Token &Result, const char *CurPtr) { in LexAngledStringLiteral() argument
2056 const char *AfterLessPos = CurPtr; in LexAngledStringLiteral()
2057 char C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2062 C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2065 (C == 0 && (CurPtr - 1 == BufferEnd))) { // End of file. in LexAngledStringLiteral()
2073 if (isCodeCompletionPoint(CurPtr - 1)) { in LexAngledStringLiteral()
2074 codeCompleteIncludedFile(AfterLessPos, CurPtr - 1, /*IsAngled=*/true); in LexAngledStringLiteral()
2076 FormTokenWithChars(Result, CurPtr - 1, tok::unknown); in LexAngledStringLiteral()
2079 NulCharacter = CurPtr-1; in LexAngledStringLiteral()
2081 C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2090 FormTokenWithChars(Result, CurPtr, tok::header_name); in LexAngledStringLiteral()
2130 bool Lexer::LexCharConstant(Token &Result, const char *CurPtr, in LexCharConstant() argument
2144 char C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2148 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexCharConstant()
2155 C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2158 (C == 0 && CurPtr-1 == BufferEnd)) { // End of file. in LexCharConstant()
2161 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexCharConstant()
2166 if (isCodeCompletionPoint(CurPtr-1)) { in LexCharConstant()
2168 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexCharConstant()
2173 NulCharacter = CurPtr-1; in LexCharConstant()
2175 C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2180 CurPtr = LexUDSuffix(Result, CurPtr, false); in LexCharConstant()
2188 FormTokenWithChars(Result, CurPtr, Kind); in LexCharConstant()
2197 bool Lexer::SkipWhitespace(Token &Result, const char *CurPtr, in SkipWhitespace() argument
2200 bool SawNewline = isVerticalWhitespace(CurPtr[-1]); in SkipWhitespace()
2202 unsigned char Char = *CurPtr; in SkipWhitespace()
2211 setLastNewLine(CurPtr - 1); in SkipWhitespace()
2217 Char = *++CurPtr; in SkipWhitespace()
2225 BufferPtr = CurPtr; in SkipWhitespace()
2230 if (*CurPtr == '\n') in SkipWhitespace()
2231 setLastNewLine(CurPtr); in SkipWhitespace()
2233 Char = *++CurPtr; in SkipWhitespace()
2238 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipWhitespace()
2248 char PrevChar = CurPtr[-1]; in SkipWhitespace()
2263 BufferPtr = CurPtr; in SkipWhitespace()
2273 bool Lexer::SkipLineComment(Token &Result, const char *CurPtr, in SkipLineComment() argument
2293 C = *CurPtr; in SkipLineComment()
2297 C = *++CurPtr; in SkipLineComment()
2299 const char *NextLine = CurPtr; in SkipLineComment()
2302 const char *EscapePtr = CurPtr-1; in SkipLineComment()
2311 CurPtr = EscapePtr; in SkipLineComment()
2315 CurPtr = EscapePtr-2; in SkipLineComment()
2328 const char *OldPtr = CurPtr; in SkipLineComment()
2331 C = getAndAdvanceChar(CurPtr, Result); in SkipLineComment()
2336 if (C != 0 && CurPtr == OldPtr+1) { in SkipLineComment()
2337 CurPtr = NextLine; in SkipLineComment()
2344 if (CurPtr != OldPtr + 1 && C != '/' && in SkipLineComment()
2345 (CurPtr == BufferEnd + 1 || CurPtr[0] != '/')) { in SkipLineComment()
2346 for (; OldPtr != CurPtr; ++OldPtr) in SkipLineComment()
2351 const char *ForwardPtr = CurPtr; in SkipLineComment()
2364 if (C == '\r' || C == '\n' || CurPtr == BufferEnd + 1) { in SkipLineComment()
2365 --CurPtr; in SkipLineComment()
2369 if (C == '\0' && isCodeCompletionPoint(CurPtr-1)) { in SkipLineComment()
2380 getSourceLocation(CurPtr)))) { in SkipLineComment()
2381 BufferPtr = CurPtr; in SkipLineComment()
2387 return SaveLineComment(Result, CurPtr); in SkipLineComment()
2391 if (ParsingPreprocessorDirective || CurPtr == BufferEnd) { in SkipLineComment()
2392 BufferPtr = CurPtr; in SkipLineComment()
2401 NewLinePtr = CurPtr++; in SkipLineComment()
2408 BufferPtr = CurPtr; in SkipLineComment()
2414 bool Lexer::SaveLineComment(Token &Result, const char *CurPtr) { in SaveLineComment() argument
2417 FormTokenWithChars(Result, CurPtr, tok::comment); in SaveLineComment()
2442 static bool isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr, in isEndOfBlockCommentWithEscapedNewLine() argument
2444 assert(CurPtr[0] == '\n' || CurPtr[0] == '\r'); in isEndOfBlockCommentWithEscapedNewLine()
2447 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2450 if (CurPtr[0] == '\n' || CurPtr[0] == '\r') { in isEndOfBlockCommentWithEscapedNewLine()
2452 if (CurPtr[0] == CurPtr[1]) in isEndOfBlockCommentWithEscapedNewLine()
2455 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2461 while (isHorizontalWhitespace(*CurPtr) || *CurPtr == 0) { in isEndOfBlockCommentWithEscapedNewLine()
2462 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2467 if (*CurPtr == '\\') { in isEndOfBlockCommentWithEscapedNewLine()
2468 if (CurPtr[-1] != '*') return false; in isEndOfBlockCommentWithEscapedNewLine()
2471 if (CurPtr[0] != '/' || CurPtr[-1] != '?' || CurPtr[-2] != '?' || in isEndOfBlockCommentWithEscapedNewLine()
2472 CurPtr[-3] != '*') in isEndOfBlockCommentWithEscapedNewLine()
2476 CurPtr -= 2; in isEndOfBlockCommentWithEscapedNewLine()
2482 L->Diag(CurPtr, diag::trigraph_ignored_block_comment); in isEndOfBlockCommentWithEscapedNewLine()
2486 L->Diag(CurPtr, diag::trigraph_ends_block_comment); in isEndOfBlockCommentWithEscapedNewLine()
2491 L->Diag(CurPtr, diag::escaped_newline_block_comment_end); in isEndOfBlockCommentWithEscapedNewLine()
2495 L->Diag(CurPtr, diag::backslash_newline_space); in isEndOfBlockCommentWithEscapedNewLine()
2516 bool Lexer::SkipBlockComment(Token &Result, const char *CurPtr, in SkipBlockComment() argument
2527 unsigned char C = getCharAndSize(CurPtr, CharSize); in SkipBlockComment()
2528 CurPtr += CharSize; in SkipBlockComment()
2529 if (C == 0 && CurPtr == BufferEnd+1) { in SkipBlockComment()
2532 --CurPtr; in SkipBlockComment()
2537 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipBlockComment()
2541 BufferPtr = CurPtr; in SkipBlockComment()
2548 C = *CurPtr++; in SkipBlockComment()
2553 if (CurPtr + 24 < BufferEnd && in SkipBlockComment()
2558 while (C != '/' && ((intptr_t)CurPtr & 0x0F) != 0) in SkipBlockComment()
2559 C = *CurPtr++; in SkipBlockComment()
2565 while (CurPtr+16 <= BufferEnd) { in SkipBlockComment()
2566 int cmp = _mm_movemask_epi8(_mm_cmpeq_epi8(*(const __m128i*)CurPtr, in SkipBlockComment()
2572 CurPtr += llvm::countTrailingZeros<unsigned>(cmp) + 1; in SkipBlockComment()
2575 CurPtr += 16; in SkipBlockComment()
2582 while (CurPtr + 16 <= BufferEnd && in SkipBlockComment()
2583 !vec_any_eq(*(const __vector unsigned char *)CurPtr, Slashes)) in SkipBlockComment()
2584 CurPtr += 16; in SkipBlockComment()
2587 while (CurPtr[0] != '/' && in SkipBlockComment()
2588 CurPtr[1] != '/' && in SkipBlockComment()
2589 CurPtr[2] != '/' && in SkipBlockComment()
2590 CurPtr[3] != '/' && in SkipBlockComment()
2591 CurPtr+4 < BufferEnd) { in SkipBlockComment()
2592 CurPtr += 4; in SkipBlockComment()
2597 C = *CurPtr++; in SkipBlockComment()
2602 C = *CurPtr++; in SkipBlockComment()
2606 if (CurPtr[-2] == '*') // We found the final */. We're done! in SkipBlockComment()
2609 if ((CurPtr[-2] == '\n' || CurPtr[-2] == '\r')) { in SkipBlockComment()
2610 if (isEndOfBlockCommentWithEscapedNewLine(CurPtr-2, this)) { in SkipBlockComment()
2616 if (CurPtr[0] == '*' && CurPtr[1] != '/') { in SkipBlockComment()
2621 Diag(CurPtr-1, diag::warn_nested_block_comment); in SkipBlockComment()
2623 } else if (C == 0 && CurPtr == BufferEnd+1) { in SkipBlockComment()
2629 --CurPtr; in SkipBlockComment()
2634 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipBlockComment()
2638 BufferPtr = CurPtr; in SkipBlockComment()
2640 } else if (C == '\0' && isCodeCompletionPoint(CurPtr-1)) { in SkipBlockComment()
2646 C = *CurPtr++; in SkipBlockComment()
2652 getSourceLocation(CurPtr)))) { in SkipBlockComment()
2653 BufferPtr = CurPtr; in SkipBlockComment()
2659 FormTokenWithChars(Result, CurPtr, tok::comment); in SkipBlockComment()
2667 if (isHorizontalWhitespace(*CurPtr)) { in SkipBlockComment()
2668 SkipWhitespace(Result, CurPtr+1, TokAtPhysicalStartOfLine); in SkipBlockComment()
2673 BufferPtr = CurPtr; in SkipBlockComment()
2691 const char *CurPtr = BufferPtr; in ReadToEndOfLine() local
2693 char Char = getAndAdvanceChar(CurPtr, Tmp); in ReadToEndOfLine()
2701 if (CurPtr-1 != BufferEnd) { in ReadToEndOfLine()
2702 if (isCodeCompletionPoint(CurPtr-1)) { in ReadToEndOfLine()
2718 assert(CurPtr[-1] == Char && "Trigraphs for newline?"); in ReadToEndOfLine()
2719 BufferPtr = CurPtr-1; in ReadToEndOfLine()
2740 bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) { in LexEndOfFile() argument
2748 FormTokenWithChars(Result, CurPtr, tok::eod); in LexEndOfFile()
2782 if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')) { in LexEndOfFile()
2804 BufferPtr = CurPtr; in LexEndOfFile()
2848 static const char *FindConflictEnd(const char *CurPtr, const char *BufferEnd, in FindConflictEnd() argument
2852 auto RestOfBuffer = StringRef(CurPtr, BufferEnd - CurPtr).substr(TermLen); in FindConflictEnd()
2871 bool Lexer::IsStartOfConflictMarker(const char *CurPtr) { in IsStartOfConflictMarker() argument
2873 if (CurPtr != BufferStart && in IsStartOfConflictMarker()
2874 CurPtr[-1] != '\n' && CurPtr[-1] != '\r') in IsStartOfConflictMarker()
2878 if (!StringRef(CurPtr, BufferEnd - CurPtr).startswith("<<<<<<<") && in IsStartOfConflictMarker()
2879 !StringRef(CurPtr, BufferEnd - CurPtr).startswith(">>>> ")) in IsStartOfConflictMarker()
2887 ConflictMarkerKind Kind = *CurPtr == '<' ? CMK_Normal : CMK_Perforce; in IsStartOfConflictMarker()
2891 if (FindConflictEnd(CurPtr, BufferEnd, Kind)) { in IsStartOfConflictMarker()
2894 Diag(CurPtr, diag::err_conflict_marker); in IsStartOfConflictMarker()
2899 while (*CurPtr != '\r' && *CurPtr != '\n') { in IsStartOfConflictMarker()
2900 assert(CurPtr != BufferEnd && "Didn't find end of line"); in IsStartOfConflictMarker()
2901 ++CurPtr; in IsStartOfConflictMarker()
2903 BufferPtr = CurPtr; in IsStartOfConflictMarker()
2915 bool Lexer::HandleEndOfConflictMarker(const char *CurPtr) { in HandleEndOfConflictMarker() argument
2917 if (CurPtr != BufferStart && in HandleEndOfConflictMarker()
2918 CurPtr[-1] != '\n' && CurPtr[-1] != '\r') in HandleEndOfConflictMarker()
2928 if (CurPtr[i] != CurPtr[0]) in HandleEndOfConflictMarker()
2934 if (const char *End = FindConflictEnd(CurPtr, BufferEnd, in HandleEndOfConflictMarker()
2936 CurPtr = End; in HandleEndOfConflictMarker()
2939 while (CurPtr != BufferEnd && *CurPtr != '\r' && *CurPtr != '\n') in HandleEndOfConflictMarker()
2940 ++CurPtr; in HandleEndOfConflictMarker()
2942 BufferPtr = CurPtr; in HandleEndOfConflictMarker()
2952 static const char *findPlaceholderEnd(const char *CurPtr, in findPlaceholderEnd() argument
2954 if (CurPtr == BufferEnd) in findPlaceholderEnd()
2957 for (; CurPtr != BufferEnd; ++CurPtr) { in findPlaceholderEnd()
2958 if (CurPtr[0] == '#' && CurPtr[1] == '>') in findPlaceholderEnd()
2959 return CurPtr + 2; in findPlaceholderEnd()
2964 bool Lexer::lexEditorPlaceholder(Token &Result, const char *CurPtr) { in lexEditorPlaceholder() argument
2965 assert(CurPtr[-1] == '<' && CurPtr[0] == '#' && "Not a placeholder!"); in lexEditorPlaceholder()
2968 const char *End = findPlaceholderEnd(CurPtr + 1, BufferEnd); in lexEditorPlaceholder()
2971 const char *Start = CurPtr - 1; in lexEditorPlaceholder()
2983 bool Lexer::isCodeCompletionPoint(const char *CurPtr) const { in isCodeCompletionPoint()
2985 SourceLocation Loc = FileLoc.getLocWithOffset(CurPtr-BufferStart); in isCodeCompletionPoint()
3011 const char *CurPtr = StartPtr + CharSize; in tryReadUCN() local
3012 const char *KindLoc = &CurPtr[-1]; in tryReadUCN()
3016 char C = getCharAndSize(CurPtr, CharSize); in tryReadUCN()
3042 CurPtr += CharSize; in tryReadUCN()
3047 if (CurPtr - StartPtr == (ptrdiff_t)NumHexDigits + 2) in tryReadUCN()
3048 StartPtr = CurPtr; in tryReadUCN()
3050 while (StartPtr != CurPtr) in tryReadUCN()
3053 StartPtr = CurPtr; in tryReadUCN()
3104 const char *CurPtr) { in CheckUnicodeWhitespace() argument
3110 << makeCharRange(*this, BufferPtr, CurPtr); in CheckUnicodeWhitespace()
3118 bool Lexer::LexUnicode(Token &Result, uint32_t C, const char *CurPtr) { in LexUnicode() argument
3123 makeCharRange(*this, BufferPtr, CurPtr), in LexUnicode()
3126 makeCharRange(*this, BufferPtr, CurPtr)); in LexUnicode()
3130 return LexIdentifier(Result, CurPtr); in LexUnicode()
3146 << FixItHint::CreateRemoval(makeCharRange(*this, BufferPtr, CurPtr)); in LexUnicode()
3148 BufferPtr = CurPtr; in LexUnicode()
3155 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexUnicode()
3208 const char *CurPtr = BufferPtr; in LexTokenInternal() local
3211 if (isHorizontalWhitespace(*CurPtr)) { in LexTokenInternal()
3213 ++CurPtr; in LexTokenInternal()
3214 } while (isHorizontalWhitespace(*CurPtr)); in LexTokenInternal()
3220 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexTokenInternal()
3225 BufferPtr = CurPtr; in LexTokenInternal()
3232 char Char = getAndAdvanceChar(CurPtr, Result); in LexTokenInternal()
3241 if (CurPtr-1 == BufferEnd) in LexTokenInternal()
3242 return LexEndOfFile(Result, CurPtr-1); in LexTokenInternal()
3245 if (isCodeCompletionPoint(CurPtr-1)) { in LexTokenInternal()
3248 FormTokenWithChars(Result, CurPtr, tok::code_completion); in LexTokenInternal()
3253 Diag(CurPtr-1, diag::null_in_file); in LexTokenInternal()
3255 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3266 Diag(CurPtr-1, diag::ext_ctrl_z_eof_microsoft); in LexTokenInternal()
3267 return LexEndOfFile(Result, CurPtr-1); in LexTokenInternal()
3275 if (CurPtr[0] == '\n') in LexTokenInternal()
3276 (void)getAndAdvanceChar(CurPtr, Result); in LexTokenInternal()
3292 NewLinePtr = CurPtr - 1; in LexTokenInternal()
3301 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3313 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3317 CurPtr = BufferPtr; in LexTokenInternal()
3321 if (CurPtr[0] == '/' && CurPtr[1] == '/' && !inKeepCommentMode() && in LexTokenInternal()
3324 if (SkipLineComment(Result, CurPtr+2, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3327 } else if (CurPtr[0] == '/' && CurPtr[1] == '*' && !inKeepCommentMode()) { in LexTokenInternal()
3328 if (SkipBlockComment(Result, CurPtr+2, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3331 } else if (isHorizontalWhitespace(*CurPtr)) { in LexTokenInternal()
3344 return LexNumericConstant(Result, CurPtr); in LexTokenInternal()
3351 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3355 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3360 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3365 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3367 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3372 char Char2 = getCharAndSize(CurPtr + SizeTmp, SizeTmp2); in LexTokenInternal()
3377 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3382 Result, ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3388 char Char3 = getCharAndSize(CurPtr + SizeTmp + SizeTmp2, SizeTmp3); in LexTokenInternal()
3392 ConsumeChar(ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3402 return LexIdentifier(Result, CurPtr); in LexTokenInternal()
3409 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3413 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3418 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3423 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3425 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3431 return LexIdentifier(Result, CurPtr); in LexTokenInternal()
3438 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3442 ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3447 return LexIdentifier(Result, CurPtr); in LexTokenInternal()
3452 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3456 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3461 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3463 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3469 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3486 return LexIdentifier(Result, CurPtr); in LexTokenInternal()
3491 Diag(CurPtr-1, diag::ext_dollar_in_identifier); in LexTokenInternal()
3494 return LexIdentifier(Result, CurPtr); in LexTokenInternal()
3504 return LexCharConstant(Result, CurPtr, tok::char_constant); in LexTokenInternal()
3510 return LexStringLiteral(Result, CurPtr, in LexTokenInternal()
3537 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3542 return LexNumericConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result)); in LexTokenInternal()
3545 CurPtr += SizeTmp; in LexTokenInternal()
3547 getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '.') { in LexTokenInternal()
3549 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3556 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3559 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3562 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3568 if (getCharAndSize(CurPtr, SizeTmp) == '=') { in LexTokenInternal()
3570 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3576 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3578 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3581 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3588 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3590 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3593 getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '*') { // C++ ->* in LexTokenInternal()
3594 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3598 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3601 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3611 if (getCharAndSize(CurPtr, SizeTmp) == '=') { in LexTokenInternal()
3613 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3620 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3634 TreatAsComment = getCharAndSize(CurPtr+SizeTmp, SizeTmp2) != '*'; in LexTokenInternal()
3637 if (SkipLineComment(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3649 if (SkipBlockComment(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3659 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3666 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3669 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3672 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3674 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3675 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3676 if (Char == '%' && getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == ':') { in LexTokenInternal()
3678 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3681 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3700 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3702 return LexAngledStringLiteral(Result, CurPtr); in LexTokenInternal()
3704 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
3707 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3709 } else if (After == '<' && IsStartOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
3713 } else if (After == '<' && HandleEndOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
3719 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3722 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3726 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
3731 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3741 getSourceLocation(CurPtr + SizeTmp, SizeTmp2), " "); in LexTokenInternal()
3744 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3748 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == ':') { in LexTokenInternal()
3755 char After = getCharAndSize(CurPtr + SizeTmp + SizeTmp2, SizeTmp3); in LexTokenInternal()
3764 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3767 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3770 lexEditorPlaceholder(Result, CurPtr)) { in LexTokenInternal()
3777 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3779 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3782 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
3784 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3787 } else if (After == '>' && IsStartOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
3791 } else if (After == '>' && HandleEndOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
3796 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3799 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3807 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3809 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3812 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3819 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3822 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3825 if (CurPtr[1] == '|' && HandleEndOfConflictMarker(CurPtr-1)) in LexTokenInternal()
3828 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3834 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3837 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3842 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3851 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3854 if (CurPtr[1] == '=' && HandleEndOfConflictMarker(CurPtr-1)) in LexTokenInternal()
3858 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3867 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3870 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3875 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3890 if (CurPtr[-1] == '@' && LangOpts.ObjC) in LexTokenInternal()
3899 if (uint32_t CodePoint = tryReadUCN(CurPtr, BufferPtr, &Result)) { in LexTokenInternal()
3900 if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) { in LexTokenInternal()
3901 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3909 return LexUnicode(Result, CodePoint, CurPtr); in LexTokenInternal()
3926 --CurPtr; in LexTokenInternal()
3928 llvm::convertUTF8Sequence((const llvm::UTF8 **)&CurPtr, in LexTokenInternal()
3933 if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) { in LexTokenInternal()
3934 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3941 return LexUnicode(Result, CodePoint, CurPtr); in LexTokenInternal()
3946 ++CurPtr; in LexTokenInternal()
3954 Diag(CurPtr, diag::err_invalid_utf8); in LexTokenInternal()
3956 BufferPtr = CurPtr+1; in LexTokenInternal()
3968 FormTokenWithChars(Result, CurPtr, Kind); in LexTokenInternal()
3974 FormTokenWithChars(Result, CurPtr, tok::hash); in LexTokenInternal()