From a3a06810836e42098c37baba492297e30bdf65c4 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 16 Oct 2011 04:47:35 +0000 Subject: Enhance llvm::SourceMgr to support diagnostic ranges, the same way clang does. Enhance the X86 asmparser to produce ranges in the one case that was annoying me, for example: test.s:10:15: error: invalid operand for instruction movl 0(%rax), 0(%edx) ^~~~~~~ It should be straight-forward to enhance filecheck, tblgen, and/or the .ll parser to use ranges where appropriate if someone is interested. llvm-svn: 142106 --- llvm/lib/MC/MCDisassembler/EDDisassembler.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'llvm/lib/MC/MCDisassembler/EDDisassembler.cpp') diff --git a/llvm/lib/MC/MCDisassembler/EDDisassembler.cpp b/llvm/lib/MC/MCDisassembler/EDDisassembler.cpp index 83362a2..5633cb1 100644 --- a/llvm/lib/MC/MCDisassembler/EDDisassembler.cpp +++ b/llvm/lib/MC/MCDisassembler/EDDisassembler.cpp @@ -337,13 +337,9 @@ int EDDisassembler::printInst(std::string &str, MCInst &inst) { return 0; } -static void diag_handler(const SMDiagnostic &diag, - void *context) -{ - if (context) { - EDDisassembler *disassembler = static_cast(context); - diag.Print("", disassembler->ErrorStream); - } +static void diag_handler(const SMDiagnostic &diag, void *context) { + if (context) + diag.print("", static_cast(context)->ErrorStream); } int EDDisassembler::parseInst(SmallVectorImpl &operands, -- cgit v1.1