瀏覽代碼

Dump the LocId with the InstId from Check (#5140)

Check can print the full location for a LocId properly, but SemIR can
not since File doesn't have access to Lex.

So when dumping InstId from Check, include the LocId, to avoid making us
type `call Dump(context, context.insts().GetLocId(x))` all the time.
Dana Jansens 1 年之前
父節點
當前提交
5a86df1058
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      toolchain/check/dump.cpp

+ 4 - 0
toolchain/check/dump.cpp

@@ -109,6 +109,10 @@ LLVM_DUMP_METHOD static auto Dump(const Context& context,
 LLVM_DUMP_METHOD static auto Dump(const Context& context, SemIR::InstId inst_id)
     -> void {
   SemIR::Dump(context.sem_ir(), inst_id);
+  auto loc_id = context.sem_ir().insts().GetLocId(inst_id);
+  llvm::errs() << "  - ";
+  DumpNoNewline(context, loc_id);
+  llvm::errs() << '\n';
 }
 
 LLVM_DUMP_METHOD static auto Dump(const Context& context,