From 3bf3b6a5a35296069c71d4f038d1d512ae72201f Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Tue, 16 Apr 2019 14:46:33 +0300 Subject: [PATCH] [codegen][debug info] improvement of generation debug info for 'finally' block --- .../org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt | 6 ++---- .../kotlin/backend/konan/lower/FinallyBlocksLowering.kt | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index b407493cef6..966656196cc 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -1577,16 +1577,14 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map irBlock(value, null, type) { - +irReturnableBlock(symbol, type) { + +irReturnableBlock(finallyExpression.startOffset, finallyExpression.endOffset, symbol, type) { +value } +copy(finallyExpression) } else -> irBlock(value, null, type) { - val tmp = irTemporary(irReturnableBlock(symbol, type) { + val tmp = irTemporary(irReturnableBlock(finallyExpression.startOffset, finallyExpression.endOffset, symbol, type) { +irReturn(symbol, value) }) +copy(finallyExpression) @@ -314,7 +314,7 @@ internal class FinallyBlocksLowering(val context: Context): FileLoweringPass, Ir fun IrBuilderWithScope.irReturn(target: IrReturnTargetSymbol, value: IrExpression) = IrReturnImpl(startOffset, endOffset, context.irBuiltIns.nothingType, target, value) - private inline fun IrBuilderWithScope.irReturnableBlock(symbol: IrReturnableBlockSymbol, + private inline fun IrBuilderWithScope.irReturnableBlock(startOffset: Int, endOffset: Int, symbol: IrReturnableBlockSymbol, type: IrType, body: IrBlockBuilder.() -> Unit) = IrReturnableBlockImpl(startOffset, endOffset, type, symbol, null, IrBlockBuilder(context, scope, startOffset, endOffset, null, type)