From 23c7c3714e94ddbb1a70d29b73244395b23fd4d4 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Thu, 30 Apr 2020 12:18:22 +0200 Subject: [PATCH] [codegen][debug-info] generate `_this` name for \ special variable --- .../kotlin/backend/konan/llvm/IrToBitcode.kt | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 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 30df3864670..b742d76ad2d 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 @@ -29,6 +29,7 @@ import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid import org.jetbrains.kotlin.ir.visitors.acceptVoid import org.jetbrains.kotlin.konan.target.CompilerOutputKind import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.descriptorUtil.classId import org.jetbrains.kotlin.resolve.descriptorUtil.module @@ -1274,7 +1275,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map") +private val underscoreThisName = Name.identifier("_this") +/** + * HACK: this is workaround for GH-2316, to let IDE some how operate with this. + * We're experiencing issue with libclang which is used as compiler of expression in lldb + * for current state support Kotlin in lldb: + * 1. isn't accepted by libclang as valid variable name. + * 2. this is reserved name and compiled in special way. + */ +private fun Name.debugNameConversion(): Name = when(this) { + thisName -> underscoreThisName + else -> this +} + class NoContextFound : Throwable() internal class LocationInfo(val scope: DIScopeOpaqueRef,