[PATCH] D64863: [clangd] Ignore diags from builtin files

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 08:44:41 PDT 2019


ilya-biryukov added a comment.

Thanks for switching to `SM` everywhere, makes the code much more readable!

A rough proposal for testing this:

  // test.cpp
  // RUN: clang++ -DFOO=b ./test.cpp
  int a = FOO;

This produces a note inside a `<command line>` buffer. We could probably have something similar pointing into a `<builtin>`



================
Comment at: clang-tools-extra/clangd/Diagnostics.cpp:473
+  SourceManager &SM = Info.getSourceManager();
+  if (!InsideMainFile && SM.isWrittenInBuiltinFile(Info.getLocation())) {
+    IgnoreDiagnostics::log(DiagLevel, Info);
----------------
There is also at least `isWrittenInCommandLineFile` and `isWrittenInScratchSpace`.
We should probably handle both of them here too.

What are we actually checking here? That we can later create a URI for this file? Is there a good way to check exactly that without breaking layering?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64863





More information about the cfe-commits mailing list