[PATCH] D40406: [clangd] Switch from YAMLParser to JSONExpr

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 23 16:10:37 PST 2017


sammccall created this revision.

- Converted Protocol.h parse() functions to take JSON::Expr. These no longer detect and log unknown fields, as this is not that useful and no longer free. I haven't changed the error handling too much: fields that were treated as optional before are still optional, even when it's wrong. Exception: object properties with the wrong type are now ignored.
- Made JSONRPCDispatcher parse using json::parse
- The bug where 'method' must come before 'params' in the stream is fixed as a side-effect. (And the same bug in executeCommand).
- Some parser crashers fixed as a side effect. e.g. https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3890
- The debug stream now prettyprints the input messages with --pretty.
- Request params are attached to traces when tracing is enabled.
- Fixed some bugs in tests (errors tolerated by YAMLParser, and off-by-ones in Content-Length that our null-termination was masking)
- Fixed a random double-escape bug in ClangdLSPServer (it was our last use of YAMLParser!)


https://reviews.llvm.org/D40406

Files:
  clangd/ClangdLSPServer.cpp
  clangd/JSONExpr.h
  clangd/JSONRPCDispatcher.cpp
  clangd/JSONRPCDispatcher.h
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/ProtocolHandlers.cpp
  clangd/Trace.cpp
  test/clangd/authority-less-uri.test
  test/clangd/definitions.test
  test/clangd/diagnostics.test
  test/clangd/did-change-watch-files.test
  test/clangd/protocol.test
  unittests/clangd/JSONExprTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40406.124118.patch
Type: text/x-patch
Size: 71506 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171124/9f311d62/attachment-0001.bin>


More information about the cfe-commits mailing list