[PATCH] D39737: [MC] Fix regression tests on Windows when git “core.autocrlf” is set to true
Zhen Cao via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 7 13:54:13 PST 2017
caoz updated this revision to Diff 121978.
caoz added a comment.
Thanks Reid. The fix doesn't have regressions on Linux, as supports both styles of line ending ("\r\n" and "\n").
https://reviews.llvm.org/D39737
Files:
lib/MC/MCParser/AsmLexer.cpp
Index: lib/MC/MCParser/AsmLexer.cpp
===================================================================
--- lib/MC/MCParser/AsmLexer.cpp
+++ lib/MC/MCParser/AsmLexer.cpp
@@ -210,8 +210,8 @@
int CurChar = getNextChar();
while (CurChar != '\n' && CurChar != '\r' && CurChar != EOF)
CurChar = getNextChar();
- if (CurChar == '\r')
- CurPtr++;
+ if (CurChar == '\r' && CurPtr != CurBuf.end() && *(CurPtr + 1) == '\n')
+ CurPtr++;
// If we have a CommentConsumer, notify it about the comment.
if (CommentConsumer) {
@@ -612,8 +612,8 @@
case '\r':
IsAtStartOfLine = true;
IsAtStartOfStatement = true;
- if (CurChar == '\r')
- CurPtr++;
+ if (CurChar == '\r' && CurPtr != CurBuf.end() && *(CurPtr + 1) == '\n')
+ CurPtr++;
return AsmToken(AsmToken::EndOfStatement, StringRef(TokStart, 1));
case ':': return AsmToken(AsmToken::Colon, StringRef(TokStart, 1));
case '+': return AsmToken(AsmToken::Plus, StringRef(TokStart, 1));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39737.121978.patch
Type: text/x-patch
Size: 989 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171107/ba8a3601/attachment.bin>
More information about the llvm-commits
mailing list