HomePhabricator

[clangd] Rewrite JSON dispatcher loop using C IO (FILE*) instead of std…

Description

[clangd] Rewrite JSON dispatcher loop using C IO (FILE*) instead of std::istream.

Summary:
The EINTR loop around getline was added to fix an issue with mac gdb, but seems
to loop infinitely in rare cases on linux where the parent editor exits (most
reports with VSCode).
I can't work out how to fix this in a portable way with std::istream, but the
C APIs have clearer contracts and LLVM has a RetryAfterSignal function for use
with them which seems battle-tested.

While here, clean up some inconsistency around \n in log messages (now
add it only after JSON payloads), and reduce the scope of the
long-message handling which was only really added to fight fuzzers.

Reviewers: malaperle, ilya-biryukov

Subscribers: klimek, ioeric, jkorous, cfe-commits

Differential Revision: https://reviews.llvm.org/D47643

Details

Committed
sammccallJun 5 2018, 2:34 AM
Differential Revision
D47643: Rewrite JSON dispatcher loop using C IO (FILE*) instead of std::istream.
Parents
rL333992: Fix ClangParserTest.cpp
Branches
Unknown
Tags
Unknown