IR: do not use Ir*Impl elements where it's not necessary
(cherry picked from commit f9abf365ced93599ff9f4ce38472d89813232228)
This commit is contained in:
committed by
Vasily Levchenko
parent
9a4e8b83b2
commit
e3f77e9c82
+1
-1
@@ -119,7 +119,7 @@ internal class BuiltInFictitiousFunctionIrClassFactory(
|
||||
}
|
||||
}
|
||||
|
||||
private fun createTypeParameter(descriptor: TypeParameterDescriptor) =
|
||||
private fun createTypeParameter(descriptor: TypeParameterDescriptor): IrTypeParameter =
|
||||
symbolTable?.declareGlobalTypeParameter(
|
||||
SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, DECLARATION_ORIGIN_FUNCTION_CLASS,
|
||||
descriptor
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ internal class SpecialDeclarationsFactory(val context: Context) {
|
||||
}
|
||||
|
||||
private fun createBridge(function: IrSimpleFunction,
|
||||
bridgeDirections: BridgeDirections) = WrappedSimpleFunctionDescriptor().let { descriptor ->
|
||||
bridgeDirections: BridgeDirections): IrSimpleFunction = WrappedSimpleFunctionDescriptor().let { descriptor ->
|
||||
val startOffset = function.startOffset
|
||||
val endOffset = function.endOffset
|
||||
val returnType = when (bridgeDirections.array[0]) {
|
||||
|
||||
+1
-1
@@ -1207,7 +1207,7 @@ private class ObjCBlockPointerValuePassing(
|
||||
}
|
||||
}
|
||||
|
||||
private fun IrBuilderWithScope.generateKotlinFunctionClass(): IrConstructorImpl {
|
||||
private fun IrBuilderWithScope.generateKotlinFunctionClass(): IrConstructor {
|
||||
val symbols = stubs.symbols
|
||||
|
||||
val classDescriptor = WrappedClassDescriptor()
|
||||
|
||||
+8
-3
@@ -9,7 +9,10 @@ import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
import org.jetbrains.kotlin.ir.builders.*
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl
|
||||
import org.jetbrains.kotlin.ir.descriptors.WrappedSimpleFunctionDescriptor
|
||||
@@ -21,7 +24,9 @@ import org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionSymbolImpl
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.impl.*
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
import org.jetbrains.kotlin.ir.util.constructors
|
||||
import org.jetbrains.kotlin.ir.util.irBuilder
|
||||
import org.jetbrains.kotlin.ir.util.irCatch
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
internal class CFunctionBuilder {
|
||||
@@ -101,7 +106,7 @@ private fun createKotlinBridge(
|
||||
cBridgeName: String,
|
||||
stubs: KotlinStubs,
|
||||
isExternal: Boolean
|
||||
): IrFunctionImpl {
|
||||
): IrFunction {
|
||||
val bridgeDescriptor = WrappedSimpleFunctionDescriptor()
|
||||
@Suppress("DEPRECATION") val bridge = IrFunctionImpl(
|
||||
startOffset,
|
||||
|
||||
+10
-7
@@ -8,13 +8,16 @@ package org.jetbrains.kotlin.backend.konan.lower
|
||||
import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
||||
import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext
|
||||
import org.jetbrains.kotlin.backend.common.ir.*
|
||||
import org.jetbrains.kotlin.backend.common.lower.*
|
||||
import org.jetbrains.kotlin.backend.konan.Context
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.synthesizedName
|
||||
import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
|
||||
import org.jetbrains.kotlin.backend.common.pop
|
||||
import org.jetbrains.kotlin.backend.common.push
|
||||
import org.jetbrains.kotlin.backend.konan.Context
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.synthesizedName
|
||||
import org.jetbrains.kotlin.backend.konan.llvm.functionName
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
import org.jetbrains.kotlin.ir.builders.*
|
||||
@@ -156,7 +159,7 @@ internal class CallableReferenceLowering(val context: Context): FileLoweringPass
|
||||
typeParam.symbol to functionReference.getTypeArgument(typeParam.index)!!
|
||||
}
|
||||
|
||||
private val functionReferenceClass = WrappedClassDescriptor().let {
|
||||
private val functionReferenceClass: IrClass = WrappedClassDescriptor().let {
|
||||
IrClassImpl(
|
||||
startOffset,endOffset,
|
||||
DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
|
||||
@@ -251,7 +254,7 @@ internal class CallableReferenceLowering(val context: Context): FileLoweringPass
|
||||
return BuiltFunctionReference(functionReferenceClass, constructor)
|
||||
}
|
||||
|
||||
private fun buildConstructor() = WrappedClassConstructorDescriptor().let {
|
||||
private fun buildConstructor(): IrConstructor = WrappedClassConstructorDescriptor().let {
|
||||
IrConstructorImpl(
|
||||
startOffset, endOffset,
|
||||
DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
|
||||
@@ -304,7 +307,7 @@ internal class CallableReferenceLowering(val context: Context): FileLoweringPass
|
||||
private val IrFunction.fullName: String
|
||||
get() = parent.fqNameForIrSerialization.child(Name.identifier(functionName)).asString()
|
||||
|
||||
private fun buildInvokeMethod(superFunction: IrSimpleFunction) = WrappedSimpleFunctionDescriptor().let {
|
||||
private fun buildInvokeMethod(superFunction: IrSimpleFunction): IrSimpleFunction = WrappedSimpleFunctionDescriptor().let {
|
||||
IrFunctionImpl(
|
||||
startOffset, endOffset,
|
||||
DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
|
||||
|
||||
+2
-5
@@ -17,10 +17,7 @@ import org.jetbrains.kotlin.backend.konan.llvm.IntrinsicType
|
||||
import org.jetbrains.kotlin.backend.konan.llvm.tryGetIntrinsicType
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.ir.builders.*
|
||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
import org.jetbrains.kotlin.ir.declarations.IrEnumEntry
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrPropertyImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin.ARGUMENTS_REORDERING_FOR_CALL
|
||||
@@ -214,7 +211,7 @@ internal class EnumClassLowering(val context: Context) : ClassLoweringPass {
|
||||
|
||||
private val createUninitializedInstance = context.ir.symbols.createUninitializedInstance.owner
|
||||
|
||||
private fun createSyntheticValuesPropertyDeclaration(enumEntries: List<IrEnumEntry>): IrPropertyImpl {
|
||||
private fun createSyntheticValuesPropertyDeclaration(enumEntries: List<IrEnumEntry>): IrProperty {
|
||||
val startOffset = irClass.startOffset
|
||||
val endOffset = irClass.endOffset
|
||||
|
||||
|
||||
+2
-2
@@ -106,7 +106,7 @@ internal class EnumConstructorsLowering(val context: Context) : ClassLoweringPas
|
||||
return loweredEnumConstructor
|
||||
}
|
||||
|
||||
private fun lowerEnumConstructor(constructor: IrConstructor): IrConstructorImpl {
|
||||
private fun lowerEnumConstructor(constructor: IrConstructor): IrConstructor {
|
||||
val startOffset = constructor.startOffset
|
||||
val endOffset = constructor.endOffset
|
||||
val loweredConstructor = WrappedClassConstructorDescriptor(
|
||||
@@ -133,7 +133,7 @@ internal class EnumConstructorsLowering(val context: Context) : ClassLoweringPas
|
||||
}
|
||||
}
|
||||
|
||||
fun createSynthesizedValueParameter(index: Int, name: String, type: IrType) =
|
||||
fun createSynthesizedValueParameter(index: Int, name: String, type: IrType): IrValueParameter =
|
||||
WrappedValueParameterDescriptor().let {
|
||||
IrValueParameterImpl(
|
||||
startOffset, endOffset,
|
||||
|
||||
+4
-4
@@ -335,7 +335,7 @@ internal class TestProcessor (val context: Context) {
|
||||
*/
|
||||
private fun buildObjectGetter(objectSymbol: IrClassSymbol,
|
||||
owner: IrClass,
|
||||
getterName: Name) = WrappedSimpleFunctionDescriptor().let { descriptor ->
|
||||
getterName: Name): IrSimpleFunction = WrappedSimpleFunctionDescriptor().let { descriptor ->
|
||||
IrFunctionImpl(
|
||||
owner.startOffset, owner.endOffset,
|
||||
TEST_SUITE_GENERATED_MEMBER,
|
||||
@@ -374,7 +374,7 @@ internal class TestProcessor (val context: Context) {
|
||||
*/
|
||||
private fun buildInstanceGetter(classSymbol: IrClassSymbol,
|
||||
owner: IrClass,
|
||||
getterName: Name) = WrappedSimpleFunctionDescriptor().let { descriptor ->
|
||||
getterName: Name): IrSimpleFunction = WrappedSimpleFunctionDescriptor().let { descriptor ->
|
||||
IrFunctionImpl(
|
||||
owner.startOffset, owner.endOffset,
|
||||
TEST_SUITE_GENERATED_MEMBER,
|
||||
@@ -424,7 +424,7 @@ internal class TestProcessor (val context: Context) {
|
||||
testSuite: IrClassSymbol,
|
||||
owner: IrClass,
|
||||
functions: Collection<TestFunction>,
|
||||
ignored: Boolean) = WrappedClassConstructorDescriptor().let { descriptor ->
|
||||
ignored: Boolean): IrConstructor = WrappedClassConstructorDescriptor().let { descriptor ->
|
||||
IrConstructorImpl(
|
||||
testSuite.owner.startOffset, testSuite.owner.endOffset,
|
||||
TEST_SUITE_GENERATED_MEMBER,
|
||||
@@ -477,7 +477,7 @@ internal class TestProcessor (val context: Context) {
|
||||
*/
|
||||
private fun buildClassSuite(testClass: IrClass,
|
||||
testCompanion: IrClass?,
|
||||
functions: Collection<TestFunction>) = WrappedClassDescriptor().let { descriptor ->
|
||||
functions: Collection<TestFunction>): IrClass = WrappedClassDescriptor().let { descriptor ->
|
||||
IrClassImpl(
|
||||
testClass.startOffset, testClass.endOffset,
|
||||
TEST_SUITE_CLASS,
|
||||
|
||||
Reference in New Issue
Block a user