Drop unused descriptor-based print functions from native context
(cherry picked from commit 0863cda12a0bd3f652535cb42e8c348e9ab81400)
This commit is contained in:
committed by
Vasily Levchenko
parent
0c5a07f968
commit
212393e419
-48
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.backend.konan
|
||||
|
||||
import llvm.*
|
||||
import org.jetbrains.kotlin.backend.common.DumpIrTreeWithDescriptorsVisitor
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.*
|
||||
import org.jetbrains.kotlin.backend.konan.ir.KonanIr
|
||||
import org.jetbrains.kotlin.library.SerializedMetadata
|
||||
@@ -21,11 +20,9 @@ import org.jetbrains.kotlin.descriptors.impl.PropertyDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.ReceiverParameterDescriptorImpl
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.SourceManager
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFieldImpl
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrTypeParameterImpl
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
||||
@@ -48,9 +45,7 @@ import org.jetbrains.kotlin.backend.common.ir.copyToWithoutSuperTypes
|
||||
import org.jetbrains.kotlin.backend.konan.objcexport.ObjCExport
|
||||
import org.jetbrains.kotlin.backend.konan.llvm.coverage.CoverageManager
|
||||
import org.jetbrains.kotlin.ir.descriptors.WrappedSimpleFunctionDescriptor
|
||||
import org.jetbrains.kotlin.ir.descriptors.WrappedTypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.konan.library.KonanLibraryLayout
|
||||
import org.jetbrains.kotlin.library.SerializedIrModule
|
||||
@@ -364,49 +359,6 @@ internal class Context(config: KonanConfig) : KonanBackendContext(config) {
|
||||
irModule!!.accept(DumpIrTreeVisitor(out), "")
|
||||
}
|
||||
|
||||
fun printIrWithDescriptors() {
|
||||
if (irModule == null) return
|
||||
separator("IR:")
|
||||
irModule!!.accept(DumpIrTreeWithDescriptorsVisitor(out), "")
|
||||
}
|
||||
|
||||
fun printLocations() {
|
||||
if (irModule == null) return
|
||||
separator("Locations:")
|
||||
irModule!!.acceptVoid(object: IrElementVisitorVoid {
|
||||
override fun visitElement(element: IrElement) {
|
||||
element.acceptChildrenVoid(this)
|
||||
}
|
||||
|
||||
override fun visitFile(declaration: IrFile) {
|
||||
val fileEntry = declaration.fileEntry
|
||||
declaration.acceptChildren(object: IrElementVisitor<Unit, Int> {
|
||||
override fun visitElement(element: IrElement, data: Int) {
|
||||
for (i in 0..data) print(" ")
|
||||
println("${element.javaClass.name}: ${fileEntry.range(element)}")
|
||||
element.acceptChildren(this, data + 1)
|
||||
}
|
||||
}, 0)
|
||||
}
|
||||
|
||||
fun SourceManager.FileEntry.range(element:IrElement):String {
|
||||
try {
|
||||
/* wasn't use multi line string to prevent appearing odd line
|
||||
* breaks in the dump. */
|
||||
return "${this.name}: ${this.line(element.startOffset)}" +
|
||||
":${this.column(element.startOffset)} - " +
|
||||
"${this.line(element.endOffset)}" +
|
||||
":${this.column(element.endOffset)}"
|
||||
|
||||
} catch (e:Exception) {
|
||||
return "${this.name}: ERROR(${e.javaClass.name}): ${e.message}"
|
||||
}
|
||||
}
|
||||
fun SourceManager.FileEntry.line(offset:Int) = this.getLineNumber(offset)
|
||||
fun SourceManager.FileEntry.column(offset:Int) = this.getColumnNumber(offset)
|
||||
})
|
||||
}
|
||||
|
||||
fun verifyBitCode() {
|
||||
if (llvmModule == null) return
|
||||
verifyModule(llvmModule!!)
|
||||
|
||||
Reference in New Issue
Block a user