[all-commits] [llvm/llvm-project] 5de2d1: [Diagnose] Unify MCContext and LLVMContext diagnosing

Yuanfang Chen via All-commits all-commits at lists.llvm.org
Mon Mar 1 15:59:17 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5de2d189e6ad466a1f0616195e8c524a4eb3cbc0
      https://github.com/llvm/llvm-project/commit/5de2d189e6ad466a1f0616195e8c524a4eb3cbc0
  Author: Yuanfang Chen <yuanfang.chen at sony.com>
  Date:   2021-03-01 (Mon, 01 Mar 2021)

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

  Log Message:
  -----------
  [Diagnose] Unify MCContext and LLVMContext diagnosing

The situation with inline asm/MC error reporting is kind of messy at the
moment. The errors from MC layout are not reliably propagated 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 inlineasm, 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 prints SMDiagnostic.
* Change a few clients(Clang, llc, lldb) to use the new way of reporting.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D97449




More information about the All-commits mailing list