[clang] [Clang][Diagnose] New feature: Nested/Indented diagnostic message in sarif mode. (PR #174106)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 31 23:57:13 PST 2025
================
@@ -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
----------------
Sirraide wrote:
Er, if you’re going to use `std::variant`, then please use type-based rather than index-based accessors (e.g. `std::get_if`).
https://github.com/llvm/llvm-project/pull/174106
More information about the cfe-commits
mailing list