[PATCH] D131084: Add support for specifying the severity of a SARIF Result.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 08:31:02 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Basic/Sarif.h:157
+/// 1. <a href="https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/sarif-v2.1.0-os.html#_Toc34317648">level property</a>
+enum class SarifResultLevel { Note, Warning, Error };
+
----------------
Should this include `Remark` for diagnostics like: https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Basic/DiagnosticFrontendKinds.td#L55

If not, I think the comments should explain how to map remarks to one of these levels.


================
Comment at: clang/lib/Basic/Sarif.cpp:25
 #include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/JSON.h"
----------------
Why was this include required?


================
Comment at: clang/lib/Basic/Sarif.cpp:396-399
+  if (Result.LevelOverride.hasValue())
+    Ret["level"] = resultLevelToStr(Result.LevelOverride.getValue());
+  else
+    Ret["level"] = resultLevelToStr(Rule.DefaultConfiguration.Level);
----------------
(Probably have to re-run clang-format)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131084/new/

https://reviews.llvm.org/D131084



More information about the cfe-commits mailing list