================
@@ -30,6 +30,38 @@
namespace clang {
+SarifResultLevel getSarifResultLevel(DiagnosticsEngine::Level level) {
+ switch (level) {
+ case DiagnosticsEngine::Ignored:
+ llvm_unreachable("Invalid diagnostic type");
+ case DiagnosticsEngine::Note:
+ return SarifResultLevel::Note;
+ case DiagnosticsEngine::Remark:
+ return SarifResultLevel::None;
+ case DiagnosticsEngine::Warning:
+ return SarifResultLevel::Warning;
+ case DiagnosticsEngine::Error:
+ case DiagnosticsEngine::Fatal:
+ return SarifResultLevel::Error;
+ }
+ llvm_unreachable("Potentially un-handled DiagnosticsEngine::Level. "
+ "Is the switch not fully covered?");
+}
+
+SarifRule addDiagnosticLevelToRule(SarifRule Rule,
+ DiagnosticsEngine::Level Level) {
+ SarifReportingConfiguration Config =
+ SarifReportingConfiguration::create().setLevel(
+ getSarifResultLevel(Level));
+
+ if (Level == DiagnosticsEngine::Error)
+ Config = Config.setRank(50);
----------------
vbvictor wrote:
Can we define these "rank" numbers somewhere? (And hopefully what they mean
like "rank::error", "rank::fatal") etc..
https://github.com/llvm/llvm-project/pull/219182
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits