[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


================
@@ -166,8 +166,12 @@ DiagnosticsEngine::DiagState::getOrAddMapping(diag::kind Diag) {
       DiagMap.insert(std::make_pair(Diag, DiagnosticMapping()));
 
   // Initialize the entry if we added it.
-  if (Result.second)
-    Result.first->second = DiagnosticIDs::getDefaultMapping(Diag);
+  if (Result.second) {
+    Result.first->second = DiagIDs.getDefaultMapping(Diag);
+    if (DiagnosticIDs::IsCustomDiag(Diag)) {
+      DiagIDs.initCustomDiagMapping(Result.first->second, Diag);
+    }
----------------
AaronBallman wrote:

```suggestion
    if (DiagnosticIDs::IsCustomDiag(Diag))
      DiagIDs.initCustomDiagMapping(Result.first->second, Diag);
```

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


More information about the cfe-commits mailing list