[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
This commit is contained in:
committed by
Nikolay Igotti
parent
86a4c65f32
commit
3fb208cb9d
+1
-2
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user