[PATCH] D53406: [clangd] Provide excuses for bad code completions, based on diagnostics. C++ API only.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 24 02:39:03 PDT 2018


ilya-biryukov added inline comments.


================
Comment at: clangd/CodeComplete.cpp:700
+     unsigned DiagLoc = Loc.second;
+     if (DiagLoc < StartOfLine || DiagLoc > Offset)
+       return;
----------------
kadircet wrote:
> There are also a lot of cases where we can't find an include file(usually due to confused compile commands) and fail miserably. Maybe in addition to checking current line, we could also check for lines that are starting with `#include` or diags of type `diag::err_pp_file_not_found` ?
Good point!
It's even more complicated than that: some of those missing files might be in preamble.
This will lead to preamble being incomplete. The problem with that is that DiagnosticsConsumer we create for completion will not see those errors (we have a separate consumer instance for preamble).
So we also need to a way to keep the reason why preamble is broken in the preamble itself.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53406





More information about the cfe-commits mailing list