[clang] [clang-tools-extra] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 11 08:21:56 PDT 2024


================
@@ -200,7 +273,33 @@ class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
   // FIXME: Replace this function with a create-only facilty like
   // createCustomDiagIDFromFormatString() to enforce safe usage. At the time of
   // writing, nearly all callers of this function were invalid.
-  unsigned getCustomDiagID(Level L, StringRef FormatString);
+  unsigned getCustomDiagID(CustomDiagDesc Diag);
+
+  [[deprecated("Use a CustomDiagDesc instead of a Level")]] unsigned
+  getCustomDiagID(Level Level, StringRef Message) {
+    return getCustomDiagID([&]() -> CustomDiagDesc {
+      switch (Level) {
+      case DiagnosticIDs::Level::Ignored:
+        return {diag::Severity::Ignored, std::string(Message), CLASS_WARNING,
----------------
AaronBallman wrote:

If it's ignored, why is it class warning and should be shown in system headers?

Actually, why are all of these saying to show in system headers? Was that the previous behavior and we're just matching it?

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


More information about the cfe-commits mailing list