[clang] [clang-tools-extra] [llvm] [clang] Introduce diagnostics suppression mappings (PR #112517)
kadir çetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 28 02:38:18 PDT 2024
================
@@ -946,6 +953,24 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
return (Level)Diags->getDiagnosticLevel(DiagID, Loc, *this);
}
+ /// Diagnostic suppression mappings can be used to ignore diagnostics based on
+ /// the file they occur in. Mapping file is expected to be a special case list
+ /// with sections denoting diagnostic groups and `src` entries for globs to
+ /// suppress. `emit` category can be used to disable suppression. Longest glob
+ /// that matches a filepath takes precendence. For example:
+ /// [unused]
+ /// src:*clang/*
+ /// src:*clang/foo/*=emit
+ /// src:*clang/foo/bar/*
+ ///
+ /// Such a mappings file suppress all diagnostics produced by -Wunused in all
+ /// sources under `clang/` directory apart from `clang/foo/`. Diagnostics
----------------
kadircet wrote:
because filepaths are relative to execution root of clang, and not all projects/build systems run clang in the source root. so we can have prefixes like `../../` or `build/genfiles/` .
happy to drop that if you think that looks confusing.
https://github.com/llvm/llvm-project/pull/112517
More information about the cfe-commits
mailing list