[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
Wed Nov 8 15:53:06 PST 2017
caoz updated this revision to Diff 122169.
caoz added a comment.
Thank the reviewers for your comments. I added a regression test for Linux. This solves the line ending issue for git. I would appreciate it If anyone could let me know a solution for svn.
https://reviews.llvm.org/D39737
Files:
.gitattributes
lib/MC/MCParser/AsmLexer.cpp
test/MC/AsmParser/preserve-comments-crlf.s
Index: test/MC/AsmParser/preserve-comments-crlf.s
===================================================================
--- /dev/null
+++ test/MC/AsmParser/preserve-comments-crlf.s
@@ -0,0 +1,13 @@
+ #RUN: llvm-mc -preserve-comments -n -triple i386-linux-gnu < %s > %t
+ #RUN: diff %s %t
+ .text
+
+foo: #Comment here
+ #comment here
+ nop
+ #if DIRECTIVE COMMENT
+ ## WHOLE LINE COMMENT
+ cmpl $196, %eax ## EOL COMMENT
+ #endif
+ .ident "clang version 3.9.0"
+ .section ".note.GNU-stack","", at progbits
Index: lib/MC/MCParser/AsmLexer.cpp
===================================================================
--- lib/MC/MCParser/AsmLexer.cpp
+++ lib/MC/MCParser/AsmLexer.cpp
@@ -210,6 +210,8 @@
int CurChar = getNextChar();
while (CurChar != '\n' && CurChar != '\r' && CurChar != EOF)
CurChar = getNextChar();
+ if (CurChar == '\r' && CurPtr != CurBuf.end() && *CurPtr == '\n')
+ ++CurPtr;
// If we have a CommentConsumer, notify it about the comment.
if (CommentConsumer) {
Index: .gitattributes
===================================================================
--- /dev/null
+++ .gitattributes
@@ -0,0 +1,12 @@
+# binary files
+test/Object/Inputs/*.a-* binary
+test/tools/dsymutil/Inputs/* binary
+test/tools/llvm-ar/Inputs/*.lib binary
+test/tools/llvm-objdump/Inputs/*.a binary
+test/tools/llvm-rc/Inputs/* binary
+test/tools/llvm-strings/Inputs/numbers binary
+test/MC/AsmParser/incbin_abcd binary
+test/YAMLParser/spec-09-02.test binary
+
+# Windows line ending test
+test/MC/AsmParser/preserve-comments-crlf.s text eol=crlf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39737.122169.patch
Type: text/x-patch
Size: 1552 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171108/cac8d32e/attachment.bin>
More information about the llvm-commits
mailing list