[PATCH] D48116: [libclang] Allow skipping warnings from all included files

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 13 02:16:54 PST 2018


ilya-biryukov added a comment.

In D48116#1322878 <https://reviews.llvm.org/D48116#1322878>, @nik wrote:

> In D48116#1144732 <https://reviews.llvm.org/D48116#1144732>, @ilya-biryukov wrote:
>
> > Have you considered doing the same filtering in ASTUnit's `StoredDiagnosticConsumer`? It should not be more difficult and allows to avoid changing the clang's diagnostic interfaces. That's what we do in clangd.
>
>
> Hmm, it's a bit strange that StoredDiagnosticConsumer should also start to filter things.


I

> For filtering in StoredDiagnosticConsumer one needs to pass the new bool everywhere along where "bool CaptureDiagnostics" is already passed on (to end up in the StoredDiagnosticConsumer constructor) . Also, ASTUnit::CaptureDiagnostics is then not enough anymore since the new bool is also needed in getMainBufferWithPrecompiledPreamble(). One could also (2) convert  "bool CaptureDiagnostics" to an enum with enumerators like CaptureNothing, CaptureAll, CaptureAllWithoutNonErrorsFromIncludes to make this a bit less invasive.
>  If changing clang's diagnostic interface should be avoided, I tend to go with (2). Ilya?

Yeah, LG. The changes in the `ASTUnit` look strictly better than changes in clang - the latter seems to already provide enough to do the filtering.
If you avoid changing the `StoredDiagnosticConsumer` (or writing a filtering wrapper for `DiagnosticConsumer`), you'll end up having some diagnostics inside headers generated **after** preamble was built, right?
That might be either ok or not, depending on the use-case.


Repository:
  rC Clang

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

https://reviews.llvm.org/D48116





More information about the cfe-commits mailing list