[clang-tools-extra] r330609 - [clangd][tests] Fix delimiter handling

Jan Korous via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 23 08:58:43 PDT 2018


Author: jkorous
Date: Mon Apr 23 08:58:42 2018
New Revision: 330609

URL: http://llvm.org/viewvc/llvm-project?rev=330609&view=rev
Log:
[clangd][tests] Fix delimiter handling

Empty line shouldn't be considered a delimiter

Differential Revision: https://reviews.llvm.org/D45764

Added:
    clang-tools-extra/trunk/test/clangd/spaces-in-delimited-input.test
Modified:
    clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp

Modified: clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp?rev=330609&r1=330608&r2=330609&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp (original)
+++ clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp Mon Apr 23 08:58:42 2018
@@ -278,7 +278,7 @@ static llvm::Optional<std::string> readD
       continue;
 
     // found a delimiter
-    if (LineRef.find_first_not_of('-') == llvm::StringRef::npos)
+    if (LineRef.rtrim() == "---")
       break;
 
     JSON += Line;

Added: clang-tools-extra/trunk/test/clangd/spaces-in-delimited-input.test
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clangd/spaces-in-delimited-input.test?rev=330609&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clangd/spaces-in-delimited-input.test (added)
+++ clang-tools-extra/trunk/test/clangd/spaces-in-delimited-input.test Mon Apr 23 08:58:42 2018
@@ -0,0 +1,13 @@
+# RUN: clangd -input-style=delimited -run-synchronously < %s 2>&1 | FileCheck %s
+# RUN: clangd -lit-test -run-synchronously < %s 2>&1 | FileCheck %s
+#
+{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
+
+---
+
+{"jsonrpc":"2.0","id":3,"method":"shutdown"}
+
+---
+
+{"jsonrpc":"2.0","id":3,"method":"exit"}
+# CHECK-NOT: JSON parse error




More information about the cfe-commits mailing list