Lines Matching refs:CurPtr
606 const char *CurPtr = Buffer.begin(); in ComputePreamble() local
608 while (CurPtr != Buffer.end()) { in ComputePreamble()
609 char ch = *CurPtr++; in ComputePreamble()
616 if (CurPtr != Buffer.end()) in ComputePreamble()
617 MaxLineOffset = CurPtr - Buffer.begin(); in ComputePreamble()
1696 bool Lexer::tryConsumeIdentifierUCN(const char *&CurPtr, unsigned Size, in tryConsumeIdentifierUCN() argument
1698 const char *UCNPtr = CurPtr + Size; in tryConsumeIdentifierUCN()
1699 uint32_t CodePoint = tryReadUCN(UCNPtr, CurPtr, /*Token=*/nullptr); in tryConsumeIdentifierUCN()
1711 makeCharRange(*this, CurPtr, UCNPtr), in tryConsumeIdentifierUCN()
1720 makeCharRange(*this, CurPtr, UCNPtr)); in tryConsumeIdentifierUCN()
1723 makeCharRange(*this, CurPtr, UCNPtr), in tryConsumeIdentifierUCN()
1728 if ((UCNPtr - CurPtr == 6 && CurPtr[1] == 'u') || in tryConsumeIdentifierUCN()
1729 (UCNPtr - CurPtr == 10 && CurPtr[1] == 'U')) in tryConsumeIdentifierUCN()
1730 CurPtr = UCNPtr; in tryConsumeIdentifierUCN()
1732 while (CurPtr != UCNPtr) in tryConsumeIdentifierUCN()
1733 (void)getAndAdvanceChar(CurPtr, Result); in tryConsumeIdentifierUCN()
1737 bool Lexer::tryConsumeIdentifierUTF8Char(const char *&CurPtr) { in tryConsumeIdentifierUTF8Char() argument
1738 const char *UnicodePtr = CurPtr; in tryConsumeIdentifierUTF8Char()
1758 makeCharRange(*this, CurPtr, UnicodePtr), /*IsFirst=*/false); in tryConsumeIdentifierUTF8Char()
1765 makeCharRange(*this, CurPtr, UnicodePtr)); in tryConsumeIdentifierUTF8Char()
1767 makeCharRange(*this, CurPtr, UnicodePtr), in tryConsumeIdentifierUTF8Char()
1770 makeCharRange(*this, CurPtr, UnicodePtr)); in tryConsumeIdentifierUTF8Char()
1773 CurPtr = UnicodePtr; in tryConsumeIdentifierUTF8Char()
1778 const char *CurPtr) { in LexUnicodeIdentifierStart() argument
1785 makeCharRange(*this, BufferPtr, CurPtr)); in LexUnicodeIdentifierStart()
1787 makeCharRange(*this, BufferPtr, CurPtr), in LexUnicodeIdentifierStart()
1790 makeCharRange(*this, BufferPtr, CurPtr)); in LexUnicodeIdentifierStart()
1794 return LexIdentifierContinue(Result, CurPtr); in LexUnicodeIdentifierStart()
1811 makeCharRange(*this, BufferPtr, CurPtr), /*IsStart*/ true); in LexUnicodeIdentifierStart()
1812 BufferPtr = CurPtr; in LexUnicodeIdentifierStart()
1819 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexUnicodeIdentifierStart()
1823 bool Lexer::LexIdentifierContinue(Token &Result, const char *CurPtr) { in LexIdentifierContinue() argument
1826 unsigned char C = *CurPtr; in LexIdentifierContinue()
1829 ++CurPtr; in LexIdentifierContinue()
1835 C = getCharAndSize(CurPtr, Size); in LexIdentifierContinue()
1837 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexIdentifierContinue()
1846 Diag(CurPtr, diag::ext_dollar_in_identifier); in LexIdentifierContinue()
1847 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexIdentifierContinue()
1850 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) in LexIdentifierContinue()
1852 if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) in LexIdentifierContinue()
1859 FormTokenWithChars(Result, CurPtr, tok::raw_identifier); in LexIdentifierContinue()
1876 if (isCodeCompletionPoint(CurPtr)) { in LexIdentifierContinue()
1884 assert(*CurPtr == 0 && "Completion character must be 0"); in LexIdentifierContinue()
1885 ++CurPtr; in LexIdentifierContinue()
1889 if (CurPtr < BufferEnd) { in LexIdentifierContinue()
1890 while (isAsciiIdentifierContinue(*CurPtr)) in LexIdentifierContinue()
1891 ++CurPtr; in LexIdentifierContinue()
1893 BufferPtr = CurPtr; in LexIdentifierContinue()
1919 bool Lexer::LexNumericConstant(Token &Result, const char *CurPtr) { in LexNumericConstant() argument
1921 char C = getCharAndSize(CurPtr, Size); in LexNumericConstant()
1924 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexNumericConstant()
1926 C = getCharAndSize(CurPtr, Size); in LexNumericConstant()
1934 return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); in LexNumericConstant()
1947 std::find(BufferPtr, CurPtr, '_') != CurPtr) in LexNumericConstant()
1951 return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); in LexNumericConstant()
1957 char Next = getCharAndSizeNoWarn(CurPtr + Size, NextSize, LangOpts); in LexNumericConstant()
1960 Diag(CurPtr, LangOpts.CPlusPlus in LexNumericConstant()
1963 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexNumericConstant()
1964 CurPtr = ConsumeChar(CurPtr, NextSize, Result); in LexNumericConstant()
1965 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
1970 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) in LexNumericConstant()
1971 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
1972 if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) in LexNumericConstant()
1973 return LexNumericConstant(Result, CurPtr); in LexNumericConstant()
1977 FormTokenWithChars(Result, CurPtr, tok::numeric_constant); in LexNumericConstant()
1984 const char *Lexer::LexUDSuffix(Token &Result, const char *CurPtr, in LexUDSuffix() argument
1990 char C = getCharAndSize(CurPtr, Size); in LexUDSuffix()
1994 if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) in LexUDSuffix()
1996 else if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) in LexUDSuffix()
1999 return CurPtr; in LexUDSuffix()
2004 Diag(CurPtr, in LexUDSuffix()
2007 << FixItHint::CreateInsertion(getSourceLocation(CurPtr), " "); in LexUDSuffix()
2008 return CurPtr; in LexUDSuffix()
2030 char Next = getCharAndSizeNoWarn(CurPtr + Consumed, NextSize, LangOpts); in LexUDSuffix()
2050 Diag(CurPtr, LangOpts.MSVCCompat in LexUDSuffix()
2053 << FixItHint::CreateInsertion(getSourceLocation(CurPtr), " "); in LexUDSuffix()
2054 return CurPtr; in LexUDSuffix()
2057 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexUDSuffix()
2062 C = getCharAndSize(CurPtr, Size); in LexUDSuffix()
2064 CurPtr = ConsumeChar(CurPtr, Size, Result); in LexUDSuffix()
2065 } else if (C == '\\' && tryConsumeIdentifierUCN(CurPtr, Size, Result)) { in LexUDSuffix()
2066 } else if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr)) { in LexUDSuffix()
2071 return CurPtr; in LexUDSuffix()
2076 bool Lexer::LexStringLiteral(Token &Result, const char *CurPtr, in LexStringLiteral() argument
2078 const char *AfterQuote = CurPtr; in LexStringLiteral()
2089 char C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
2094 C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
2097 (C == 0 && CurPtr-1 == BufferEnd)) { // End of file. in LexStringLiteral()
2100 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexStringLiteral()
2105 if (isCodeCompletionPoint(CurPtr-1)) { in LexStringLiteral()
2107 codeCompleteIncludedFile(AfterQuote, CurPtr - 1, /*IsAngled=*/false); in LexStringLiteral()
2110 FormTokenWithChars(Result, CurPtr - 1, tok::unknown); in LexStringLiteral()
2115 NulCharacter = CurPtr-1; in LexStringLiteral()
2117 C = getAndAdvanceChar(CurPtr, Result); in LexStringLiteral()
2122 CurPtr = LexUDSuffix(Result, CurPtr, true); in LexStringLiteral()
2130 FormTokenWithChars(Result, CurPtr, Kind); in LexStringLiteral()
2137 bool Lexer::LexRawStringLiteral(Token &Result, const char *CurPtr, in LexRawStringLiteral() argument
2149 while (PrefixLen != 16 && isRawStringDelimBody(CurPtr[PrefixLen])) in LexRawStringLiteral()
2153 if (CurPtr[PrefixLen] != '(') { in LexRawStringLiteral()
2155 const char *PrefixEnd = &CurPtr[PrefixLen]; in LexRawStringLiteral()
2168 char C = *CurPtr++; in LexRawStringLiteral()
2172 if (C == 0 && CurPtr-1 == BufferEnd) { in LexRawStringLiteral()
2173 --CurPtr; in LexRawStringLiteral()
2178 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexRawStringLiteral()
2183 const char *Prefix = CurPtr; in LexRawStringLiteral()
2184 CurPtr += PrefixLen + 1; // skip over prefix and '(' in LexRawStringLiteral()
2187 char C = *CurPtr++; in LexRawStringLiteral()
2191 if (strncmp(CurPtr, Prefix, PrefixLen) == 0 && CurPtr[PrefixLen] == '"') { in LexRawStringLiteral()
2192 CurPtr += PrefixLen + 1; // skip over prefix and '"' in LexRawStringLiteral()
2195 } else if (C == 0 && CurPtr-1 == BufferEnd) { // End of file. in LexRawStringLiteral()
2199 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexRawStringLiteral()
2206 CurPtr = LexUDSuffix(Result, CurPtr, true); in LexRawStringLiteral()
2210 FormTokenWithChars(Result, CurPtr, Kind); in LexRawStringLiteral()
2217 bool Lexer::LexAngledStringLiteral(Token &Result, const char *CurPtr) { in LexAngledStringLiteral() argument
2220 const char *AfterLessPos = CurPtr; in LexAngledStringLiteral()
2221 char C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2226 C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2229 (C == 0 && (CurPtr - 1 == BufferEnd))) { // End of file. in LexAngledStringLiteral()
2237 if (isCodeCompletionPoint(CurPtr - 1)) { in LexAngledStringLiteral()
2238 codeCompleteIncludedFile(AfterLessPos, CurPtr - 1, /*IsAngled=*/true); in LexAngledStringLiteral()
2240 FormTokenWithChars(Result, CurPtr - 1, tok::unknown); in LexAngledStringLiteral()
2243 NulCharacter = CurPtr-1; in LexAngledStringLiteral()
2245 C = getAndAdvanceChar(CurPtr, Result); in LexAngledStringLiteral()
2254 FormTokenWithChars(Result, CurPtr, tok::header_name); in LexAngledStringLiteral()
2294 bool Lexer::LexCharConstant(Token &Result, const char *CurPtr, in LexCharConstant() argument
2308 char C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2312 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexCharConstant()
2319 C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2322 (C == 0 && CurPtr-1 == BufferEnd)) { // End of file. in LexCharConstant()
2325 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexCharConstant()
2330 if (isCodeCompletionPoint(CurPtr-1)) { in LexCharConstant()
2332 FormTokenWithChars(Result, CurPtr-1, tok::unknown); in LexCharConstant()
2337 NulCharacter = CurPtr-1; in LexCharConstant()
2339 C = getAndAdvanceChar(CurPtr, Result); in LexCharConstant()
2344 CurPtr = LexUDSuffix(Result, CurPtr, false); in LexCharConstant()
2352 FormTokenWithChars(Result, CurPtr, Kind); in LexCharConstant()
2361 bool Lexer::SkipWhitespace(Token &Result, const char *CurPtr, in SkipWhitespace() argument
2364 bool SawNewline = isVerticalWhitespace(CurPtr[-1]); in SkipWhitespace()
2366 unsigned char Char = *CurPtr; in SkipWhitespace()
2375 setLastNewLine(CurPtr - 1); in SkipWhitespace()
2381 Char = *++CurPtr; in SkipWhitespace()
2389 BufferPtr = CurPtr; in SkipWhitespace()
2394 if (*CurPtr == '\n') in SkipWhitespace()
2395 setLastNewLine(CurPtr); in SkipWhitespace()
2397 Char = *++CurPtr; in SkipWhitespace()
2402 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipWhitespace()
2412 char PrevChar = CurPtr[-1]; in SkipWhitespace()
2427 BufferPtr = CurPtr; in SkipWhitespace()
2437 bool Lexer::SkipLineComment(Token &Result, const char *CurPtr, in SkipLineComment() argument
2465 C = *CurPtr; in SkipLineComment()
2469 C = *++CurPtr; in SkipLineComment()
2475 (const llvm::UTF8 *)CurPtr, (const llvm::UTF8 *)BufferEnd); in SkipLineComment()
2478 Diag(CurPtr, diag::warn_invalid_utf8_in_comment); in SkipLineComment()
2480 ++CurPtr; in SkipLineComment()
2483 CurPtr += Length; in SkipLineComment()
2488 const char *NextLine = CurPtr; in SkipLineComment()
2491 const char *EscapePtr = CurPtr-1; in SkipLineComment()
2500 CurPtr = EscapePtr; in SkipLineComment()
2504 CurPtr = EscapePtr-2; in SkipLineComment()
2517 const char *OldPtr = CurPtr; in SkipLineComment()
2520 C = getAndAdvanceChar(CurPtr, Result); in SkipLineComment()
2525 if (C != 0 && CurPtr == OldPtr+1) { in SkipLineComment()
2526 CurPtr = NextLine; in SkipLineComment()
2533 if (CurPtr != OldPtr + 1 && C != '/' && in SkipLineComment()
2534 (CurPtr == BufferEnd + 1 || CurPtr[0] != '/')) { in SkipLineComment()
2535 for (; OldPtr != CurPtr; ++OldPtr) in SkipLineComment()
2540 const char *ForwardPtr = CurPtr; in SkipLineComment()
2553 if (C == '\r' || C == '\n' || CurPtr == BufferEnd + 1) { in SkipLineComment()
2554 --CurPtr; in SkipLineComment()
2558 if (C == '\0' && isCodeCompletionPoint(CurPtr-1)) { in SkipLineComment()
2569 getSourceLocation(CurPtr)))) { in SkipLineComment()
2570 BufferPtr = CurPtr; in SkipLineComment()
2576 return SaveLineComment(Result, CurPtr); in SkipLineComment()
2580 if (ParsingPreprocessorDirective || CurPtr == BufferEnd) { in SkipLineComment()
2581 BufferPtr = CurPtr; in SkipLineComment()
2590 NewLinePtr = CurPtr++; in SkipLineComment()
2597 BufferPtr = CurPtr; in SkipLineComment()
2603 bool Lexer::SaveLineComment(Token &Result, const char *CurPtr) { in SaveLineComment() argument
2606 FormTokenWithChars(Result, CurPtr, tok::comment); in SaveLineComment()
2631 static bool isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr, Lexer *L, in isEndOfBlockCommentWithEscapedNewLine() argument
2633 assert(CurPtr[0] == '\n' || CurPtr[0] == '\r'); in isEndOfBlockCommentWithEscapedNewLine()
2642 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2645 if (CurPtr[0] == '\n' || CurPtr[0] == '\r') { in isEndOfBlockCommentWithEscapedNewLine()
2647 if (CurPtr[0] == CurPtr[1]) in isEndOfBlockCommentWithEscapedNewLine()
2650 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2655 while (isHorizontalWhitespace(*CurPtr) || *CurPtr == 0) { in isEndOfBlockCommentWithEscapedNewLine()
2656 SpacePos = CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2657 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2661 if (*CurPtr == '\\') { in isEndOfBlockCommentWithEscapedNewLine()
2662 --CurPtr; in isEndOfBlockCommentWithEscapedNewLine()
2663 } else if (CurPtr[0] == '/' && CurPtr[-1] == '?' && CurPtr[-2] == '?') { in isEndOfBlockCommentWithEscapedNewLine()
2665 TrigraphPos = CurPtr - 2; in isEndOfBlockCommentWithEscapedNewLine()
2666 CurPtr -= 3; in isEndOfBlockCommentWithEscapedNewLine()
2673 if (*CurPtr == '*') in isEndOfBlockCommentWithEscapedNewLine()
2676 if (*CurPtr != '\n' && *CurPtr != '\r') in isEndOfBlockCommentWithEscapedNewLine()
2694 L->Diag(CurPtr + 1, diag::escaped_newline_block_comment_end); in isEndOfBlockCommentWithEscapedNewLine()
2719 bool Lexer::SkipBlockComment(Token &Result, const char *CurPtr, in SkipBlockComment() argument
2730 unsigned char C = getCharAndSize(CurPtr, CharSize); in SkipBlockComment()
2731 CurPtr += CharSize; in SkipBlockComment()
2732 if (C == 0 && CurPtr == BufferEnd+1) { in SkipBlockComment()
2735 --CurPtr; in SkipBlockComment()
2740 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipBlockComment()
2744 BufferPtr = CurPtr; in SkipBlockComment()
2751 C = *CurPtr++; in SkipBlockComment()
2762 if (CurPtr + 24 < BufferEnd && in SkipBlockComment()
2767 while (C != '/' && (intptr_t)CurPtr % 16 != 0) { in SkipBlockComment()
2770 C = *CurPtr++; in SkipBlockComment()
2776 while (CurPtr + 16 < BufferEnd) { in SkipBlockComment()
2777 int Mask = _mm_movemask_epi8(*(const __m128i *)CurPtr); in SkipBlockComment()
2782 int cmp = _mm_movemask_epi8(_mm_cmpeq_epi8(*(const __m128i*)CurPtr, in SkipBlockComment()
2788 CurPtr += llvm::countTrailingZeros<unsigned>(cmp) + 1; in SkipBlockComment()
2791 CurPtr += 16; in SkipBlockComment()
2801 while (CurPtr + 16 < BufferEnd) { in SkipBlockComment()
2803 vec_any_ge(*(const __vector unsigned char *)CurPtr, LongUTF))) in SkipBlockComment()
2805 if (vec_any_eq(*(const __vector unsigned char *)CurPtr, Slashes)) { in SkipBlockComment()
2808 CurPtr += 16; in SkipBlockComment()
2812 while (CurPtr + 16 < BufferEnd) { in SkipBlockComment()
2815 HasNonASCII |= !isASCII(CurPtr[I]); in SkipBlockComment()
2822 HasSlash |= CurPtr[I] == '/'; in SkipBlockComment()
2825 CurPtr += 16; in SkipBlockComment()
2830 C = *CurPtr++; in SkipBlockComment()
2839 C = *CurPtr++; in SkipBlockComment()
2846 (const llvm::UTF8 *)CurPtr - 1, (const llvm::UTF8 *)BufferEnd); in SkipBlockComment()
2849 Diag(CurPtr - 1, diag::warn_invalid_utf8_in_comment); in SkipBlockComment()
2853 CurPtr += Length - 1; in SkipBlockComment()
2855 C = *CurPtr++; in SkipBlockComment()
2860 if (CurPtr[-2] == '*') // We found the final */. We're done! in SkipBlockComment()
2863 if ((CurPtr[-2] == '\n' || CurPtr[-2] == '\r')) { in SkipBlockComment()
2864 if (isEndOfBlockCommentWithEscapedNewLine(CurPtr - 2, this, in SkipBlockComment()
2871 if (CurPtr[0] == '*' && CurPtr[1] != '/') { in SkipBlockComment()
2876 Diag(CurPtr-1, diag::warn_nested_block_comment); in SkipBlockComment()
2878 } else if (C == 0 && CurPtr == BufferEnd+1) { in SkipBlockComment()
2884 --CurPtr; in SkipBlockComment()
2889 FormTokenWithChars(Result, CurPtr, tok::unknown); in SkipBlockComment()
2893 BufferPtr = CurPtr; in SkipBlockComment()
2895 } else if (C == '\0' && isCodeCompletionPoint(CurPtr-1)) { in SkipBlockComment()
2901 C = *CurPtr++; in SkipBlockComment()
2907 getSourceLocation(CurPtr)))) { in SkipBlockComment()
2908 BufferPtr = CurPtr; in SkipBlockComment()
2914 FormTokenWithChars(Result, CurPtr, tok::comment); in SkipBlockComment()
2922 if (isHorizontalWhitespace(*CurPtr)) { in SkipBlockComment()
2923 SkipWhitespace(Result, CurPtr+1, TokAtPhysicalStartOfLine); in SkipBlockComment()
2928 BufferPtr = CurPtr; in SkipBlockComment()
2946 const char *CurPtr = BufferPtr; in ReadToEndOfLine() local
2948 char Char = getAndAdvanceChar(CurPtr, Tmp); in ReadToEndOfLine()
2956 if (CurPtr-1 != BufferEnd) { in ReadToEndOfLine()
2957 if (isCodeCompletionPoint(CurPtr-1)) { in ReadToEndOfLine()
2973 assert(CurPtr[-1] == Char && "Trigraphs for newline?"); in ReadToEndOfLine()
2974 BufferPtr = CurPtr-1; in ReadToEndOfLine()
2995 bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) { in LexEndOfFile() argument
3003 FormTokenWithChars(Result, CurPtr, tok::eod); in LexEndOfFile()
3042 if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')) { in LexEndOfFile()
3064 BufferPtr = CurPtr; in LexEndOfFile()
3115 static const char *FindConflictEnd(const char *CurPtr, const char *BufferEnd, in FindConflictEnd() argument
3119 auto RestOfBuffer = StringRef(CurPtr, BufferEnd - CurPtr).substr(TermLen); in FindConflictEnd()
3138 bool Lexer::IsStartOfConflictMarker(const char *CurPtr) { in IsStartOfConflictMarker() argument
3140 if (CurPtr != BufferStart && in IsStartOfConflictMarker()
3141 CurPtr[-1] != '\n' && CurPtr[-1] != '\r') in IsStartOfConflictMarker()
3145 if (!StringRef(CurPtr, BufferEnd - CurPtr).startswith("<<<<<<<") && in IsStartOfConflictMarker()
3146 !StringRef(CurPtr, BufferEnd - CurPtr).startswith(">>>> ")) in IsStartOfConflictMarker()
3154 ConflictMarkerKind Kind = *CurPtr == '<' ? CMK_Normal : CMK_Perforce; in IsStartOfConflictMarker()
3158 if (FindConflictEnd(CurPtr, BufferEnd, Kind)) { in IsStartOfConflictMarker()
3161 Diag(CurPtr, diag::err_conflict_marker); in IsStartOfConflictMarker()
3166 while (*CurPtr != '\r' && *CurPtr != '\n') { in IsStartOfConflictMarker()
3167 assert(CurPtr != BufferEnd && "Didn't find end of line"); in IsStartOfConflictMarker()
3168 ++CurPtr; in IsStartOfConflictMarker()
3170 BufferPtr = CurPtr; in IsStartOfConflictMarker()
3182 bool Lexer::HandleEndOfConflictMarker(const char *CurPtr) { in HandleEndOfConflictMarker() argument
3184 if (CurPtr != BufferStart && in HandleEndOfConflictMarker()
3185 CurPtr[-1] != '\n' && CurPtr[-1] != '\r') in HandleEndOfConflictMarker()
3195 if (CurPtr[i] != CurPtr[0]) in HandleEndOfConflictMarker()
3201 if (const char *End = FindConflictEnd(CurPtr, BufferEnd, in HandleEndOfConflictMarker()
3203 CurPtr = End; in HandleEndOfConflictMarker()
3206 while (CurPtr != BufferEnd && *CurPtr != '\r' && *CurPtr != '\n') in HandleEndOfConflictMarker()
3207 ++CurPtr; in HandleEndOfConflictMarker()
3209 BufferPtr = CurPtr; in HandleEndOfConflictMarker()
3219 static const char *findPlaceholderEnd(const char *CurPtr, in findPlaceholderEnd() argument
3221 if (CurPtr == BufferEnd) in findPlaceholderEnd()
3224 for (; CurPtr != BufferEnd; ++CurPtr) { in findPlaceholderEnd()
3225 if (CurPtr[0] == '#' && CurPtr[1] == '>') in findPlaceholderEnd()
3226 return CurPtr + 2; in findPlaceholderEnd()
3231 bool Lexer::lexEditorPlaceholder(Token &Result, const char *CurPtr) { in lexEditorPlaceholder() argument
3232 assert(CurPtr[-1] == '<' && CurPtr[0] == '#' && "Not a placeholder!"); in lexEditorPlaceholder()
3235 const char *End = findPlaceholderEnd(CurPtr + 1, BufferEnd); in lexEditorPlaceholder()
3238 const char *Start = CurPtr - 1; in lexEditorPlaceholder()
3250 bool Lexer::isCodeCompletionPoint(const char *CurPtr) const { in isCodeCompletionPoint()
3252 SourceLocation Loc = FileLoc.getLocWithOffset(CurPtr-BufferStart); in isCodeCompletionPoint()
3283 const char *CurPtr = StartPtr + CharSize; in tryReadNumericUCN() local
3284 const char *KindLoc = &CurPtr[-1]; in tryReadNumericUCN()
3288 char C = getCharAndSize(CurPtr, CharSize); in tryReadNumericUCN()
3291 CurPtr += CharSize; in tryReadNumericUCN()
3296 CurPtr += CharSize; in tryReadNumericUCN()
3319 CurPtr += CharSize; in tryReadNumericUCN()
3362 if (CurPtr - StartPtr == (ptrdiff_t)(Count + 1 + (Delimited ? 2 : 0))) in tryReadNumericUCN()
3363 StartPtr = CurPtr; in tryReadNumericUCN()
3365 while (StartPtr != CurPtr) in tryReadNumericUCN()
3368 StartPtr = CurPtr; in tryReadNumericUCN()
3382 const char *CurPtr = StartPtr + CharSize; in tryReadNamedUCN() local
3383 const char *KindLoc = &CurPtr[-1]; in tryReadNamedUCN()
3385 C = getCharAndSize(CurPtr, CharSize); in tryReadNamedUCN()
3391 CurPtr += CharSize; in tryReadNamedUCN()
3392 const char *StartName = CurPtr; in tryReadNamedUCN()
3396 C = getCharAndSize(CurPtr, CharSize); in tryReadNamedUCN()
3397 CurPtr += CharSize; in tryReadNamedUCN()
3425 << makeCharRange(*this, StartName, CurPtr - CharSize); in tryReadNamedUCN()
3429 makeCharRange(*this, StartName, CurPtr - CharSize), in tryReadNamedUCN()
3456 if (CurPtr - StartPtr == (ptrdiff_t)(Buffer.size() + 3)) in tryReadNamedUCN()
3457 StartPtr = CurPtr; in tryReadNamedUCN()
3459 while (StartPtr != CurPtr) in tryReadNamedUCN()
3462 StartPtr = CurPtr; in tryReadNamedUCN()
3531 const char *CurPtr) { in CheckUnicodeWhitespace() argument
3535 << makeCharRange(*this, BufferPtr, CurPtr); in CheckUnicodeWhitespace()
3593 const char *CurPtr = BufferPtr; in LexTokenInternal() local
3596 if (isHorizontalWhitespace(*CurPtr)) { in LexTokenInternal()
3598 ++CurPtr; in LexTokenInternal()
3599 } while (isHorizontalWhitespace(*CurPtr)); in LexTokenInternal()
3605 FormTokenWithChars(Result, CurPtr, tok::unknown); in LexTokenInternal()
3610 BufferPtr = CurPtr; in LexTokenInternal()
3617 char Char = getAndAdvanceChar(CurPtr, Result); in LexTokenInternal()
3626 if (CurPtr-1 == BufferEnd) in LexTokenInternal()
3627 return LexEndOfFile(Result, CurPtr-1); in LexTokenInternal()
3630 if (isCodeCompletionPoint(CurPtr-1)) { in LexTokenInternal()
3633 FormTokenWithChars(Result, CurPtr, tok::code_completion); in LexTokenInternal()
3638 Diag(CurPtr-1, diag::null_in_file); in LexTokenInternal()
3640 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3651 Diag(CurPtr-1, diag::ext_ctrl_z_eof_microsoft); in LexTokenInternal()
3652 return LexEndOfFile(Result, CurPtr-1); in LexTokenInternal()
3660 if (CurPtr[0] == '\n') in LexTokenInternal()
3661 (void)getAndAdvanceChar(CurPtr, Result); in LexTokenInternal()
3677 NewLinePtr = CurPtr - 1; in LexTokenInternal()
3686 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3698 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3702 CurPtr = BufferPtr; in LexTokenInternal()
3706 if (CurPtr[0] == '/' && CurPtr[1] == '/' && !inKeepCommentMode() && in LexTokenInternal()
3708 if (SkipLineComment(Result, CurPtr+2, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3711 } else if (CurPtr[0] == '/' && CurPtr[1] == '*' && !inKeepCommentMode()) { in LexTokenInternal()
3712 if (SkipBlockComment(Result, CurPtr+2, TokAtPhysicalStartOfLine)) in LexTokenInternal()
3715 } else if (isHorizontalWhitespace(*CurPtr)) { in LexTokenInternal()
3728 return LexNumericConstant(Result, CurPtr); in LexTokenInternal()
3738 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3742 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3747 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3752 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3754 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3759 char Char2 = getCharAndSize(CurPtr + SizeTmp, SizeTmp2); in LexTokenInternal()
3764 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3769 Result, ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3775 char Char3 = getCharAndSize(CurPtr + SizeTmp + SizeTmp2, SizeTmp3); in LexTokenInternal()
3779 ConsumeChar(ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3789 return LexIdentifierContinue(Result, CurPtr); in LexTokenInternal()
3796 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3800 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3805 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3810 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3812 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3818 return LexIdentifierContinue(Result, CurPtr); in LexTokenInternal()
3825 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3829 ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3834 return LexIdentifierContinue(Result, CurPtr); in LexTokenInternal()
3839 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3843 return LexStringLiteral(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3848 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') in LexTokenInternal()
3850 ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3856 return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3873 return LexIdentifierContinue(Result, CurPtr); in LexTokenInternal()
3878 Diag(CurPtr-1, diag::ext_dollar_in_identifier); in LexTokenInternal()
3881 return LexIdentifierContinue(Result, CurPtr); in LexTokenInternal()
3891 return LexCharConstant(Result, CurPtr, tok::char_constant); in LexTokenInternal()
3897 return LexStringLiteral(Result, CurPtr, in LexTokenInternal()
3924 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3929 return LexNumericConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result)); in LexTokenInternal()
3932 CurPtr += SizeTmp; in LexTokenInternal()
3934 getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '.') { in LexTokenInternal()
3936 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3943 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3946 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3949 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3955 if (getCharAndSize(CurPtr, SizeTmp) == '=') { in LexTokenInternal()
3957 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3963 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3965 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3968 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3975 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
3977 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3980 getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '*') { // C++ ->* in LexTokenInternal()
3981 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
3985 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3988 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
3998 if (getCharAndSize(CurPtr, SizeTmp) == '=') { in LexTokenInternal()
4000 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4007 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4021 TreatAsComment = getCharAndSize(CurPtr+SizeTmp, SizeTmp2) != '*'; in LexTokenInternal()
4024 if (SkipLineComment(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4036 if (SkipBlockComment(Result, ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4046 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4053 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4056 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4059 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4061 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4062 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4063 if (Char == '%' && getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == ':') { in LexTokenInternal()
4065 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4068 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4087 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4089 return LexAngledStringLiteral(Result, CurPtr); in LexTokenInternal()
4091 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
4094 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4096 } else if (After == '<' && IsStartOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
4100 } else if (After == '<' && HandleEndOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
4106 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4109 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4113 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
4118 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4128 getSourceLocation(CurPtr + SizeTmp, SizeTmp2), " "); in LexTokenInternal()
4131 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4135 getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == ':') { in LexTokenInternal()
4142 char After = getCharAndSize(CurPtr + SizeTmp + SizeTmp2, SizeTmp3); in LexTokenInternal()
4151 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4154 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4157 lexEditorPlaceholder(Result, CurPtr)) { in LexTokenInternal()
4164 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4166 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4169 char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2); in LexTokenInternal()
4171 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4174 } else if (After == '>' && IsStartOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
4178 } else if (After == '>' && HandleEndOfConflictMarker(CurPtr-1)) { in LexTokenInternal()
4183 CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), in LexTokenInternal()
4186 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4194 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4196 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4199 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4206 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4209 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4212 if (CurPtr[1] == '|' && HandleEndOfConflictMarker(CurPtr-1)) in LexTokenInternal()
4215 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4221 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4224 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4229 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4238 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4241 if (CurPtr[1] == '=' && HandleEndOfConflictMarker(CurPtr-1)) in LexTokenInternal()
4245 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4254 Char = getCharAndSize(CurPtr, SizeTmp); in LexTokenInternal()
4257 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4262 CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); in LexTokenInternal()
4277 if (CurPtr[-1] == '@' && LangOpts.ObjC) in LexTokenInternal()
4286 if (uint32_t CodePoint = tryReadUCN(CurPtr, BufferPtr, &Result)) { in LexTokenInternal()
4287 if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) { in LexTokenInternal()
4288 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
4296 return LexUnicodeIdentifierStart(Result, CodePoint, CurPtr); in LexTokenInternal()
4313 --CurPtr; in LexTokenInternal()
4315 llvm::convertUTF8Sequence((const llvm::UTF8 **)&CurPtr, in LexTokenInternal()
4320 if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) { in LexTokenInternal()
4321 if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) in LexTokenInternal()
4328 return LexUnicodeIdentifierStart(Result, CodePoint, CurPtr); in LexTokenInternal()
4333 ++CurPtr; in LexTokenInternal()
4341 Diag(CurPtr, diag::err_invalid_utf8); in LexTokenInternal()
4343 BufferPtr = CurPtr+1; in LexTokenInternal()
4355 FormTokenWithChars(Result, CurPtr, Kind); in LexTokenInternal()
4361 FormTokenWithChars(Result, CurPtr, tok::hash); in LexTokenInternal()