[Lldb-commits] [PATCH] D97449: [Diagnose] Unify MCContext and LLVMContext diagnosing

Yuanfang Chen via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 24 23:45:25 PST 2021


ychen created this revision.
ychen added reviewers: MaskRay, rnk, tejohnson, qcolombet, anemet.
Herald added subscribers: dexonsmith, kerbowa, hiraditya, nhaehnle, jvesely.
ychen requested review of this revision.
Herald added projects: clang, LLDB, LLVM.
Herald added subscribers: llvm-commits, lldb-commits, cfe-commits.

The situation with inline asm/MC error reporting is kind of messy at the
moment. The errors from MC layout are not reliably propagated(D96931 <https://reviews.llvm.org/D96931>) and users
have to specify an inlineasm handler separately to get inlineasm
diagnose. The latter issue is not a correctness issue but could be improved.

- Kill LLVMContext inlineasm diagnose handler and migrate it to use

DiagnoseInfo/DiagnoseHandler.

- Introduce `DiagnoseInfoSrcMgr` to diagnose SourceMgr backed errors.

This covers use cases like inline asm, MC and any clients using
SourceMgr.

- Move AsmPrinter::SrcMgrDiagInfo and its instance to MCContext. The

next step is to combine MCContext::SrcMgr and MCContext::InlineSrcMgr
because in all use cases, only one of them is used.

- If LLVMContext is available, let MCContext uses LLVMContext's diagnose

handler; if LLVMContext is not available, MCContext uses its own default
diagnose handler which just print SMDiagnostic.

- Change a few clients(Clang, llc, lldb) to use new way of reporting.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97449

Files:
  clang/lib/CodeGen/CodeGenAction.cpp
  lldb/source/Expression/IRExecutionUnit.cpp
  llvm/include/llvm/CodeGen/AsmPrinter.h
  llvm/include/llvm/IR/DiagnosticInfo.h
  llvm/include/llvm/IR/LLVMContext.h
  llvm/include/llvm/MC/MCContext.h
  llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
  llvm/lib/CodeGen/MachineModuleInfo.cpp
  llvm/lib/IR/LLVMContext.cpp
  llvm/lib/IR/LLVMContextImpl.h
  llvm/lib/MC/MCContext.cpp
  llvm/lib/MC/MCParser/AsmParser.cpp
  llvm/test/CodeGen/AMDGPU/lds-initializer.ll
  llvm/test/CodeGen/AMDGPU/lds-zero-initializer.ll
  llvm/test/CodeGen/XCore/section-name.ll
  llvm/tools/llc/llc.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97449.326302.patch
Type: text/x-patch
Size: 35753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210225/019d122c/attachment-0001.bin>


More information about the lldb-commits mailing list