[PATCH] D48116: [libclang] Allow skipping warnings from all included files
Nikolai Kosjar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 7 04:04:16 PST 2018
nik added a comment.
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.
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?
$ git grep "bool CaptureDiagnostics"
include/clang/Frontend/ASTUnit.h: bool CaptureDiagnostics = false;
include/clang/Frontend/ASTUnit.h: ASTUnit &AST, bool CaptureDiagnostics,
include/clang/Frontend/ASTUnit.h: IntrusiveRefCntPtr<DiagnosticsEngine> Diags, bool CaptureDiagnostics,
include/clang/Frontend/ASTUnit.h: bool CaptureDiagnostics = false, bool AllowPCHWithCompilerErrors = false,
include/clang/Frontend/ASTUnit.h: bool OnlyLocalDecls = false, bool CaptureDiagnostics = false,
include/clang/Frontend/ASTUnit.h: bool OnlyLocalDecls = false, bool CaptureDiagnostics = false,
include/clang/Frontend/ASTUnit.h: bool OnlyLocalDecls = false, bool CaptureDiagnostics = false,
lib/Frontend/ASTUnit.cpp: ASTUnit &AST, bool CaptureDiagnostics,
lib/Frontend/ASTUnit.cpp: bool CaptureDiagnostics, bool AllowPCHWithCompilerErrors,
lib/Frontend/ASTUnit.cpp: bool CaptureDiagnostics, bool UserFilesAreVolatile) {
lib/Frontend/ASTUnit.cpp: bool OnlyLocalDecls, bool CaptureDiagnostics,
lib/Frontend/ASTUnit.cpp: bool OnlyLocalDecls, bool CaptureDiagnostics,
lib/Frontend/ASTUnit.cpp: bool OnlyLocalDecls, bool CaptureDiagnostics,
tools/libclang/Indexing.cpp: bool CaptureDiagnostics = !Logger::isLoggingEnabled();
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