https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/233309
>From 3fd45fe544b06e79dd46e382747b5318ef6f8c7f Mon Sep 17 00:00:00 2001 From: Alex Richardson <[email protected]> Date: Wed, 28 Oct 2026 11:12:57 -0700 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 adac7ef796425..6de3bfff7347f 100644 --- a/llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp +++ b/llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp @@ -31,8 +31,8 @@ static StringRef 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)); mgr.PrintMessage(os, fileLoc, SourceMgr::DK_Error, msg, range); } else { mgr.PrintMessage(os, fileLoc, SourceMgr::DK_Error, msg); diff --git a/llvm/test/tools/llvm-mc/verify/highlight.s b/llvm/test/tools/llvm-mc/verify/highlight.s index 69b8784925a76..f7663ad8f23bb 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 d8a399985f4f0..e14bc98a3f862 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
