[PATCH] D45621: [clangd][tests] Fix delimiter handling
Jan Korous via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 13 06:18:39 PDT 2018
jkorous-apple created this revision.
jkorous-apple added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, MaskRay, ioeric, ilya-biryukov.
jkorous-apple edited the summary of this revision.
Empty line shouldn't be considered a delimiter
Following
https://reviews.llvm.org/D45620
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D45621
Files:
JSONRPCDispatcher.cpp
clangd/spaces-in-delimited-input.test
Index: clangd/spaces-in-delimited-input.test
===================================================================
--- /dev/null
+++ clangd/spaces-in-delimited-input.test
@@ -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
Index: JSONRPCDispatcher.cpp
===================================================================
--- JSONRPCDispatcher.cpp
+++ JSONRPCDispatcher.cpp
@@ -278,7 +278,7 @@
continue;
// found a delimiter
- if (LineRef.find_first_not_of('-') == llvm::StringRef::npos)
+ if (LineRef.rtrim() == "---")
break;
JSON += Line;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45621.142393.patch
Type: text/x-patch
Size: 967 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180413/c2a4347d/attachment.bin>
More information about the cfe-commits
mailing list