[clang] [clang-tools-extra] [llvm] [clang] Introduce diagnostics suppression mappings (PR #112517)

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 17 08:48:46 PDT 2024


================
@@ -946,6 +952,13 @@ 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.
+  /// These take presumed locations into account, and can still be overriden by
+  /// clang-diagnostics pragmas.
+  void setDiagSuppressionMapping(decltype(DiagSuppressionMapping) Mapping);
----------------
ilya-biryukov wrote:

This extension point looks very powerful and I would be vary of adding it to the public APIs.
I'm worried that we are opening up the flood gates to the API that will be misused.

Have you thought about restricting the public API of the DiagnosticsEngine somewhat?
Simply having a concrete class that can only be produced by parsing the diagnostics file is already enough to ensure some discussion will happen before new use-cases for this arise.

https://github.com/llvm/llvm-project/pull/112517


More information about the cfe-commits mailing list