IR: add flag to IrGenerationExtension for executing in kapt mode

#KT-56635 Fixed
This commit is contained in:
Alexander Udalov
2023-02-16 23:05:44 +01:00
committed by Space Team
parent 0eb90cccd1
commit b152600e35
2 changed files with 25 additions and 9 deletions
@@ -19,10 +19,21 @@ interface IrGenerationExtension : IrDeserializer.IrLinkerExtension {
fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext)
fun getPlatformIntrinsicExtension(backendContext: BackendContext): IrIntrinsicExtension? = null
// Returns true if this extension should also be applied in the KAPT stub generation mode in Kotlin/JVM. This mode uses light analysis
// in the compiler frontend to produce an "API-only" class file which is then converted to a .java stub. Because of the light analysis,
// the resulting IR does not have function bodies and can contain references to error types. If this method returns true, the extension
// should be ready to handle such incomplete IR. Any modifications to the IR applied during the KAPT stub generation mode will only have
// effect on the .java stub, not the resulting .class files. Compilation to the .class files is done in a separate step after stub
// generation.
//
// K2 KAPT doesn't use stub generation, so this property has no effect on extensions applied when K2 is enabled.
@FirIncompatiblePluginAPI
val shouldAlsoBeAppliedInKaptStubGenerationMode: Boolean get() = false
}
/**
* This interface for common IR is empty because intrinsics are done in a platform-specific way (because of inliner).
* Currently, only JVM intrinsics are supported via JvmIrIntrinsicExtension interface.
*/
interface IrIntrinsicExtension
interface IrIntrinsicExtension