summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/JSONExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clangd] Remove JSON library in favor of llvm/Support/JSONSam McCall2018-07-091-554/+0
| | | | | | | | | | | | | | | | | | | | Summary: The library has graduated from clangd to llvm/Support. This is a mechanical change to move to the new API and remove the old one. Main API changes: - namespace clang::clangd::json --> llvm::json - json::Expr --> json::Value - Expr::asString() etc --> Value::getAsString() etc - unsigned longs need a cast (due to r336541 adding lossless integer support) Reviewers: ilya-biryukov Subscribers: mgorny, ioeric, MaskRay, jkorous, omtcyfz, cfe-commits Differential Revision: https://reviews.llvm.org/D49077 llvm-svn: 336549
* [clangd] Fix repeated word typo. NFCFangrui Song2018-03-291-1/+1
| | | | llvm-svn: 328819
* [clangd] Put all #includes in one block in clangd source files. NFCEric Liu2017-12-141-1/+0
| | | | | | | Clang-format categorizes and sorts #includes with style. It doesn't make sense to manually managing #include blocks. llvm-svn: 320743
* [clangd] Add missing (but documented!) JSONExpr typed accessorsSam McCall2017-11-281-8/+8
| | | | | | | | | | | | | | Summary: Noticed this when I tried to port the Protocol.h parsers. And tests for the inspect API, which caught a small bug. Reviewers: ioeric Subscribers: ilya-biryukov Differential Revision: https://reviews.llvm.org/D40399 llvm-svn: 319157
* Fixing a typo; NFC.Aaron Ballman2017-11-231-1/+1
| | | | llvm-svn: 318921
* Silence some MSVC warnings about not all control paths returning a value; NFC.Aaron Ballman2017-11-211-0/+1
| | | | llvm-svn: 318809
* [clangd] Include the right header for std::isxdigitSam McCall2017-11-211-0/+10
| | | | llvm-svn: 318782
* [clangd] Satisfy GCC: 'changes meaning of Error'Sam McCall2017-11-211-5/+5
| | | | llvm-svn: 318780
* [clangd] Fix dumb && || bug from r318774Sam McCall2017-11-211-1/+1
| | | | llvm-svn: 318778
* [clangd] Add parsing and value inspection to JSONExpr.Sam McCall2017-11-211-8/+331
| | | | | | | | | | | | | | | | | | | | | Summary: This will replace the places where we're using YAMLParser to parse JSON now: - the new marshalling code (T::parse()) should handle fewer cases and require fewer explicit casts - we'll early-reject invalid JSON that YAMLParser accepts - we'll be able to fix protocol-parsing bugs caused by the fact that YAML can only parse forward I plan to do the conversion as soon as this lands, but I don't want it in one patch as the protocol.cpp changes are conflict-prone. Reviewers: ioeric Subscribers: ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D40182 llvm-svn: 318774
* [clangd] fix MSVC build errorsSam McCall2017-11-071-1/+1
| | | | llvm-svn: 317553
* [clangd] Squash namespace warningSam McCall2017-11-061-2/+7
| | | | llvm-svn: 317487
* Adds a json::Expr type to represent intermediate JSON expressions.Sam McCall2017-11-061-0/+216
Summary: This form can be created with a nice clang-format-friendly literal syntax, and gets escaping right. It knows how to call unparse() on our Protocol types. All the places where we pass around JSON internally now use this type. Object properties are sorted (stored as std::map) and so serialization is canonicalized, with optional prettyprinting (triggered by a -pretty flag). This makes the lit tests much nicer to read and somewhat nicer to debug. (Unfortunately the completion tests use CHECK-DAG, which only has line-granularity, so pretty-printing is disabled there. In future we could make completion ordering deterministic, or switch to unittests). Compared to the current approach, it has some efficiencies like avoiding copies of string literals used as object keys, but is probably slower overall. I think the code/test quality benefits are worth it. This patch doesn't attempt to do anything about JSON *parsing*. It takes direction from the proposal in this doc[1], but is limited in scope and visibility, for now. I am of half a mind just to use Expr as the target of a parser, and maybe do a little string deduplication, but not bother with clever memory allocation. That would be simple, and fast enough for clangd... [1] https://docs.google.com/document/d/1OEF9IauWwNuSigZzvvbjc1cVS1uGHRyGTXaoy3DjqM4/edit +cc d0k so he can tell me not to use std::map. Reviewers: ioeric, malaperle Subscribers: bkramer, ilya-biryukov, mgorny, klimek Differential Revision: https://reviews.llvm.org/D39435 llvm-svn: 317486
OpenPOWER on IntegriCloud