[PATCH] D38425: [clangd] Document highlights for clangd
Marc-Andre Laperle via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 28 13:32:32 PST 2017
malaperle added inline comments.
================
Comment at: clangd/ClangdLSPServer.cpp:246
+
+ C.reply(json::ary(Highlights->Value));
+}
----------------
malaperle wrote:
> I get a test failure here because there is an assertion that the Expected<> needs to be checked. I can't really think of any failure case right now where we wouldn't just return an empty array of highlights. But I think it's better for consistency and future-proofing to keep the Expected<>.
> I think you can just do like in onRename for now
> if (!Highlights) {
> C.replyError(ErrorCode::InternalError,
> llvm::toString(Highlights.takeError()));
> return;
> }
Just to be clear, the error I see in the output is:
Expected<T> must be checked before access or destruction.
Expected<T> value was in success state. (Note: Expected<T> values in success mode must still be checked prior to being destroyed).
It asserts when in ClangdLSPServer::onDocumentHighlight, referencing Highlights->Value
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D38425
More information about the cfe-commits
mailing list