diff options
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index 9b1c4b1a6..ef4cb98ec 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -7043,7 +7043,16 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo> { // `void`-returning function can get an implicit // return on exit of the body statement. - subContext->irBuilder->emitReturn(); + IRInst* returnInst = subContext->irBuilder->emitReturn(); + + if (BlockStmt* blockStmt = as<BlockStmt>(decl->body)) + { + returnInst->sourceLoc = blockStmt->closingSourceLoc; + } + else + { + returnInst->sourceLoc = SourceLoc(); + } } else { @@ -7938,7 +7947,11 @@ IRModule* generateIRForTranslationUnit( if(compileRequest->shouldDumpIR) { DiagnosticSinkWriter writer(compileRequest->getSink()); - dumpIR(module, &writer, "LOWER-TO-IR"); + + IRDumpOptions options; + options.sourceManager = compileRequest->getSourceManager(); + + dumpIR(module, options, "LOWER-TO-IR", &writer); } return module; |
