From 261fe7587d7413070a4e0f29e1a1bb7b0d2b5429 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 24 Jul 2020 16:37:51 -0700 Subject: Ensure labels are dumped in `lower-to-ir` (#1459) * Ensure labels are dumped in `lower-to-ir`. There is a `dumpIR` function that accepts a label parameter already in slang-emit.cpp. This change moves it to slang-ir.cpp so it may be called from other files. * update expected test result Co-authored-by: Yong He Co-authored-by: Tim Foley --- source/slang/slang-emit.cpp | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'source/slang/slang-emit.cpp') diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index b08f26137..7d8a4074e 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -126,29 +126,6 @@ StructTypeLayout* getGlobalStructLayout( return getScopeStructLayout(programLayout); } -static void dumpIR( - BackEndCompileRequest* compileRequest, - IRModule* irModule, - char const* label) -{ - DiagnosticSinkWriter writerImpl(compileRequest->getSink()); - WriterHelper writer(&writerImpl); - - if(label) - { - writer.put("### "); - writer.put(label); - writer.put(":\n"); - } - - dumpIR(irModule, writer.getWriter()); - - if( label ) - { - writer.put("###\n"); - } -} - static void dumpIRIfEnabled( BackEndCompileRequest* compileRequest, IRModule* irModule, @@ -156,7 +133,8 @@ static void dumpIRIfEnabled( { if(compileRequest->shouldDumpIR) { - dumpIR(compileRequest, irModule, label); + DiagnosticSinkWriter writer(compileRequest->getSink()); + dumpIR(irModule, &writer, label); } } -- cgit v1.2.3