This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Fix error handling in config.yaml parsing.
ClosedPublic

Authored by sammccall on Jul 8 2020, 3:14 PM.

Details

Summary

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

Diff Detail

Event Timeline

sammccall created this revision.Jul 8 2020, 3:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 8 2020, 3:14 PM
hokein accepted this revision.Jul 8 2020, 11:19 PM

thanks.

clang-tools-extra/clangd/ConfigYAML.cpp
36

nit: the comment is stale.

This revision is now accepted and ready to land.Jul 8 2020, 11:19 PM
This revision was automatically updated to reflect the committed changes.