[K/N] More localized debug info rejection is supported
Sometimes plugins generate code with UNDEFINED_OFFSET debug info. Probably, we can't control it, and just need to deal with it. ^KT-53667
This commit is contained in:
+3
-3
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.backend.konan.llvm
|
||||
@@ -96,8 +96,8 @@ internal class DebugInfo internal constructor(override val context: Context):Con
|
||||
*/
|
||||
private val NO_SOURCE_FILE = "no source file"
|
||||
private fun IrFileEntry.location(offset: Int, offsetToNumber: (Int) -> Int): Int {
|
||||
assert(offset != UNDEFINED_OFFSET)
|
||||
// Part "name.isEmpty() || name == NO_SOURCE_FILE" is an awful hack, @minamoto, please fix properly.
|
||||
if (offset == UNDEFINED_OFFSET) return 0
|
||||
if (offset == SYNTHETIC_OFFSET || name.isEmpty() || name == NO_SOURCE_FILE) return 1
|
||||
// lldb uses 1-based unsigned integers, so 0 is "no-info".
|
||||
val result = offsetToNumber(offset) + 1
|
||||
|
||||
+5
-9
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.backend.konan.llvm
|
||||
@@ -2167,11 +2167,11 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
||||
}
|
||||
|
||||
private val IrElement.startLocation: LocationInfo?
|
||||
get() = if (!context.shouldContainLocationDebugInfo() || startOffset == UNDEFINED_OFFSET) null
|
||||
get() = if (!context.shouldContainLocationDebugInfo()) null
|
||||
else currentCodeContext.location(startOffset)
|
||||
|
||||
private val IrElement.endLocation: LocationInfo?
|
||||
get() = if (!context.shouldContainLocationDebugInfo() || startOffset == UNDEFINED_OFFSET) null
|
||||
get() = if (!context.shouldContainLocationDebugInfo()) null
|
||||
else currentCodeContext.location(endOffset)
|
||||
|
||||
//-------------------------------------------------------------------------//
|
||||
@@ -2974,11 +2974,7 @@ private fun Name.debugNameConversion(): Name = when(this) {
|
||||
internal class LocationInfo(val scope: DIScopeOpaqueRef,
|
||||
val line: Int,
|
||||
val column: Int,
|
||||
val inlinedAt: LocationInfo? = null) {
|
||||
init {
|
||||
assert(line != 0)
|
||||
}
|
||||
}
|
||||
val inlinedAt: LocationInfo? = null)
|
||||
|
||||
internal fun Context.generateRuntimeConstantsModule() : LLVMModuleRef {
|
||||
val llvmModule = LLVMModuleCreateWithNameInContext("constants", llvmContext)!!
|
||||
|
||||
Reference in New Issue
Block a user