summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-11-14 01:28:38 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-11-14 01:28:38 +0000
commitb699e619fef502b02264264e2545ebdce7b7d12d (patch)
tree9e9cd4faef22c0ae94fea1646cda6106af5204d2 /clang/lib
parent41ae3288fd4252f753e702e7cc10a5f3c4617138 (diff)
downloadbcm5719-llvm-b699e619fef502b02264264e2545ebdce7b7d12d.tar.gz
bcm5719-llvm-b699e619fef502b02264264e2545ebdce7b7d12d.zip
Fix an assertion failure printing the unused-label fixit in files using CRLF line endings. <rdar://problem/12639047>.
llvm-svn: 167900
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Lex/Lexer.cpp9
1 files changed, 8 insertions, 1 deletions
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);
OpenPOWER on IntegriCloud