[PATCH] D59302: [clangd] Surface diagnostics from headers inside main file

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 19 03:28:43 PDT 2019


ilya-biryukov added inline comments.


================
Comment at: clangd/ClangdUnit.cpp:256
+// directive inside main file.
+// If a header is transitively included in multiple direct includes of main, we
+// choose the first one.
----------------
We should find a way to point into an exact `include` directive (source locations have this information).



================
Comment at: clangd/ClangdUnit.cpp:406
+  for (const Diag &D : ASTDiags.take()) {
+    if (!mentionsMainFile(D) && Opts.LimitDiagsOutsideMainFile &&
+        ++DiagsOutsideMainFile > *Opts.LimitDiagsOutsideMainFile)
----------------
Could we limit per-include-directive instead?
The limit to avoid creating too verbose error messages, rather than reporting too many messages, right?


================
Comment at: clangd/ClangdUnit.cpp:438
+      D.File = MainInput.getFile();
+      D.Message = "Error in header: " + D.Message;
+    }
----------------
We should provide the include stack, similar to how compiler does it.
Otherwise it would be really hard to figure out the exact problem the diagnostic is pointing at.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59302/new/

https://reviews.llvm.org/D59302





More information about the cfe-commits mailing list