================
@@ -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?");
----------------
vbvictor wrote:

nit If user sees this message there is nothing to fix from user side. IMHO 
better write `un-handled DiagnosticsEngine::Level occured`.

https://github.com/llvm/llvm-project/pull/219182
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to