From 3fb208cb9d7ac310f09b008620c45af116940c91 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 16 Oct 2017 16:16:51 +0300 Subject: [PATCH] [debug] fix line info for artificial IrElements (#941) Some IrElements have -1 as a startOffset (for example, generated methods of data classes). To represent such offsets in debuginfo, we should use 0 instead of -1, because line/columns are one-based unsigneds. closes KT-20443 --- .../src/org/jetbrains/kotlin/backend/konan/llvm/DebugUtils.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/DebugUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/DebugUtils.kt index 52d8b73f5f8..8794e292c59 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/DebugUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/DebugUtils.kt @@ -27,7 +27,6 @@ import org.jetbrains.kotlin.ir.SourceManager.FileEntry import org.jetbrains.kotlin.ir.declarations.IrFile import org.jetbrains.kotlin.js.descriptorUtils.getJetTypeFqName import org.jetbrains.kotlin.konan.file.File -import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeUtils @@ -76,7 +75,7 @@ internal class DebugInfo internal constructor(override val context: Context):Con * File entry starts offsets from zero while dwarf number lines/column starting from 1. */ private fun FileEntry.location(offset:Int, offsetToNumber:(Int) -> Int):Int { - return if (offset < 0) -1 + return if (offset < 0) 0 // lldb uses 1-based unsigned integers, so 0 is "no-info" else offsetToNumber(offset) + 1 }