[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
================
@@ -597,6 +592,15 @@ DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID, SourceLocation Loc,
return Result;
}
+DiagnosticIDs::Class DiagnosticIDs::getDiagClass(unsigned DiagID) const {
+ if (IsCustomDiag(DiagID))
+ return Class(CustomDiagInfo->getDescription(DiagID).GetClass());
+
+ if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID))
+ return Class(Info->Class);
+ return Class(~0U);
----------------
AaronBallman wrote:
This is UB because it's outside the range of representable values for the `Class` enum; maybe make it an enum member instead?
https://github.com/llvm/llvm-project/pull/70976
More information about the cfe-commits
mailing list