From b699e619fef502b02264264e2545ebdce7b7d12d Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Wed, 14 Nov 2012 01:28:38 +0000 Subject: Fix an assertion failure printing the unused-label fixit in files using CRLF line endings. . llvm-svn: 167900 --- clang/lib/Lex/Lexer.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'clang/lib/Lex/Lexer.cpp') diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index bf0883e12a2..354a44db84e 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -1319,8 +1319,15 @@ SourceLocation Lexer::findLocationAfterToken(SourceLocation Loc, C = *(++TokenEnd); NumWhitespaceChars++; } - if (isVerticalWhitespace(C)) + + // Skip \r, \n, \r\n, or \n\r + if (C == '\n' || C == '\r') { + char PrevC = C; + C = *(++TokenEnd); NumWhitespaceChars++; + if ((C == '\n' || C == '\r') && C != PrevC) + NumWhitespaceChars++; + } } return TokenLoc.getLocWithOffset(Tok.getLength() + NumWhitespaceChars); -- cgit v1.2.3