[PATCH] D83436: [clangd] Fix error handling in config.yaml parsing.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 8 15:14:06 PDT 2020


sammccall created this revision.
sammccall added a reviewer: hokein.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.

A few things were broken:

- use of Document::parseBlockNode() is incorrect and prevents moving to the next doc in error cases. Use getRoot() instead.
- bailing out in the middle of iterating over a list/dict isn't allowed, unless you are going to throw away the parser: the next skip() asserts. Always consume all items.
- There were two concepts of fatal errors: error-diagnostics and drop-fragment. (The latter is the "return false" case in the parser). They didn't coincide. Now, parser errors and explicitly emitted error diagnostics are fatal.

Fixes https://github.com/clangd/clangd/issues/452


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83436

Files:
  clang-tools-extra/clangd/ConfigYAML.cpp
  clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83436.276574.patch
Type: text/x-patch
Size: 6179 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200708/47aa7627/attachment.bin>


More information about the cfe-commits mailing list