https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/233309
>From 9c8a0089aa6e70c522356ca6a0fc457b2eac6734 Mon Sep 17 00:00:00 2001 From: Alex Richardson <[email protected]> Date: Mon, 2 Nov 2026 22:11:02 -0800 Subject: [PATCH] [nspr] initial commit --- llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp | 4 ++-- llvm/test/tools/llvm-mc/verify/highlight.s | 5 ++--- mlir/docs/Diagnostics.md | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp b/llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp index d911f63610cf42..5856ec425337b2 100644 --- a/llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp +++ b/llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp @@ -39,8 +39,8 @@ SourceMgrDiagnosticVerifier::getDiagKindStr(SourceMgr::DiagKind kind) { bool SourceMgrDiagnosticVerifier::ExpectedDiag::emitError( raw_ostream &os, SourceMgr &mgr, const Twine &msg) const { if (fileLoc.isValid()) { - SMRange range(fileLoc, SMLoc::getFromPointer(fileLoc.getPointer() + - substring.size())); + // Highlight the whole directive, up to and including the closing '}}'. + SMRange range(fileLoc, SMLoc::getFromPointer(substring.end() + 2)); printMessage(os, mgr, fileLoc, msg, range); } else { printMessage(os, mgr, fileLoc, msg); diff --git a/llvm/test/tools/llvm-mc/verify/highlight.s b/llvm/test/tools/llvm-mc/verify/highlight.s index 69b8784925a762..f7663ad8f23bb8 100644 --- a/llvm/test/tools/llvm-mc/verify/highlight.s +++ b/llvm/test/tools/llvm-mc/verify/highlight.s @@ -1,14 +1,13 @@ -## Verifier errors highlight the directive. +## Verifier errors highlight the whole directive, up to and including '}}'. # REQUIRES: x86-registered-target # RUN: rm -rf %t && split-file %s %t && cd %t # RUN: not llvm-mc --triple=x86_64 --verify input.s 2>&1 \ # RUN: | FileCheck %s --strict-whitespace -## FIXME: The highlight ends in the middle of the directive. # CHECK: input.s:1:7: error: expected error "never produced" was not produced # CHECK-NEXT: {{^}}nop # expected-error {{[{][{]}}never produced{{[}][}]}}{{$}} -# CHECK-NEXT: {{^}} ^~~~~~~~~~~~~~{{$}} +# CHECK-NEXT: {{^}} ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{{$}} #--- input.s nop # expected-error {{never produced}} diff --git a/mlir/docs/Diagnostics.md b/mlir/docs/Diagnostics.md index d8a399985f4f0f..e14bc98a3f8624 100644 --- a/mlir/docs/Diagnostics.md +++ b/mlir/docs/Diagnostics.md @@ -372,7 +372,7 @@ func.func @foo() -> (index, ind) { /tmp/test.mlir:15:4: error: expected remark "expected some remark" was not produced // expected-remark {{expected some remark}} - ^~~~~~~~~~~~~~~~~~~~~~~~~~ + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` Similarly to the [SourceMgr Diagnostic Handler](#sourcemgr-diagnostic-handler), _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
