From fc1a0ac68ee3b97aa52841b63bb316442fb880ae Mon Sep 17 00:00:00 2001 From: Zhen Cao Date: Fri, 17 Nov 2017 21:59:43 +0000 Subject: [PATCH] =?UTF-8?q?[MC]=20Fix=20regression=20tests=20on=20Windows?= =?UTF-8?q?=20when=20git=20=E2=80=9Ccore.autocrlf=E2=80=9D=20is=20set=20to?= =?UTF-8?q?=20true.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Differential Revision: https://reviews.llvm.org/D39737 This is the second attempt to commit this. The test was broken on Linux in the first attempt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318560 91177308-0d34-0410-b5e6-96231b3b80d8 --- .gitattributes | 12 ++++++++++++ docs/GettingStartedVS.rst | 5 +++++ lib/MC/MCParser/AsmLexer.cpp | 2 ++ test/MC/AsmParser/preserve-comments-crlf.s | 13 +++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 .gitattributes create mode 100644 test/MC/AsmParser/preserve-comments-crlf.s diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000..e7d6fd6d93d99 --- /dev/null +++ b/.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 diff --git a/docs/GettingStartedVS.rst b/docs/GettingStartedVS.rst index 50f7aa123c558..a4ff2b822fc35 100644 --- a/docs/GettingStartedVS.rst +++ b/docs/GettingStartedVS.rst @@ -76,6 +76,11 @@ Here's the short story for getting up and running quickly with LLVM: * With anonymous Subversion access: + *Note:* some regression tests require Unix-style line ending (``\n``). To + pass all regression tests, please add two lines *enable-auto-props = yes* + and *\* = svn:mime-type=application/octet-stream* to + ``C:\Users\\AppData\Roaming\Subversion\config``. + 1. ``cd `` 2. ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm`` 3. ``cd llvm`` diff --git a/lib/MC/MCParser/AsmLexer.cpp b/lib/MC/MCParser/AsmLexer.cpp index b83b6d3dcf6a1..74835fd70c04b 100644 --- a/lib/MC/MCParser/AsmLexer.cpp +++ b/lib/MC/MCParser/AsmLexer.cpp @@ -210,6 +210,8 @@ AsmToken AsmLexer::LexLineComment() { 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) { diff --git a/test/MC/AsmParser/preserve-comments-crlf.s b/test/MC/AsmParser/preserve-comments-crlf.s new file mode 100644 index 0000000000000..90a71ea798426 --- /dev/null +++ b/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 --strip-trailing-cr %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","",@progbits