[clang-tools-extra] r294312 - [clangd] Ignore comments in clangd input, so we can write tests without sed.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 7 07:37:17 PST 2017


Author: d0k
Date: Tue Feb  7 09:37:17 2017
New Revision: 294312

URL: http://llvm.org/viewvc/llvm-project?rev=294312&view=rev
Log:
[clangd] Ignore comments in clangd input, so we can write tests without sed.

Another attempt on making this work on windows.

Modified:
    clang-tools-extra/trunk/clangd/ClangDMain.cpp
    clang-tools-extra/trunk/test/clangd/formatting.test

Modified: clang-tools-extra/trunk/clangd/ClangDMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangDMain.cpp?rev=294312&r1=294311&r2=294312&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangDMain.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangDMain.cpp Tue Feb  7 09:37:17 2017
@@ -56,6 +56,11 @@ int main(int argc, char *argv[]) {
     if (LineRef.trim().empty())
       continue;
 
+    // We allow YAML-style comments. Technically this isn't part of the
+    // LSP specification, but makes writing tests easier.
+    if (LineRef.startswith("#"))
+      continue;
+
     unsigned long long Len = 0;
     // FIXME: Content-Type is a specified header, but does nothing.
     // Content-Length is a mandatory header. It specifies the length of the

Modified: clang-tools-extra/trunk/test/clangd/formatting.test
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clangd/formatting.test?rev=294312&r1=294311&r2=294312&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clangd/formatting.test (original)
+++ clang-tools-extra/trunk/test/clangd/formatting.test Tue Feb  7 09:37:17 2017
@@ -1,5 +1,5 @@
-# REQUIRES: shell
-# RUN: sed -e '/^#/d' -e 's/\r*$/\r/' %s | clangd | FileCheck %s
+# RUN: clangd < %s | FileCheck %s
+# It is absolutely vital that this file has CRLF line endings.
 #
 Content-Length: 125
 




More information about the cfe-commits mailing list