[clang] [Clang][Diagnose] New feature: Nested/Indented diagnostic message in sarif mode. (PR #174106)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 1 00:52:11 PST 2026


================
@@ -406,8 +406,23 @@ void SarifDocumentWriter::appendResult(const SarifResult &Result) {
 
   if (!Result.RelatedLocations.empty()) {
     json::Array ReLocs;
-    for (auto &Range : Result.RelatedLocations) {
-      ReLocs.emplace_back(createLocation(createPhysicalLocation(Range)));
+    for (auto &RelatedLocation : Result.RelatedLocations) {
+      if (RelatedLocation.index() == 0) { // variant is a SarifChildResult
----------------
anonymouspc wrote:

No problem. `std::get_if<T>` is indeed much clearer than `std::get<0>`.

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


More information about the cfe-commits mailing list