[Interop][Linker] Skip declarations from cache dependencies
This commit is contained in:
committed by
Sergey Bogolepov
parent
0e9dbf3939
commit
17b2120124
+3
-1
@@ -209,7 +209,9 @@ internal val psiToIrPhase = konanUnitPhase(
|
||||
moduleDescriptor, symbolTable,
|
||||
config.configuration.languageVersionSettings
|
||||
)
|
||||
val irProviderForCEnumsAndCStructs = IrProviderForCEnumAndCStructStubs(generatorContext, interopBuiltIns, symbols)
|
||||
val irProviderForCEnumsAndCStructs = IrProviderForCEnumAndCStructStubs(
|
||||
generatorContext, interopBuiltIns, symbols, llvmModuleSpecification::containsModule
|
||||
)
|
||||
// We need to run `buildAllEnumsAndStructsFrom` before `generateModuleFragment` because it adds references to symbolTable
|
||||
// that should be bound.
|
||||
modulesWithoutDCE
|
||||
|
||||
+8
-2
@@ -38,11 +38,17 @@ import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
* compiler phases.
|
||||
* 2. It is an easier and more obvious approach. Since implementation of metadata-based
|
||||
* libraries generation already took too much time we take an easier approach here.
|
||||
*
|
||||
* [moduleFilter] -- We want to select modules that should be part of compiler's output.
|
||||
*
|
||||
* For example, when we generate compiler cache,
|
||||
* declarations from dependencies should not be added to the current module.
|
||||
*/
|
||||
internal class IrProviderForCEnumAndCStructStubs(
|
||||
context: GeneratorContext,
|
||||
private val interopBuiltIns: InteropBuiltIns,
|
||||
symbols: KonanSymbols
|
||||
symbols: KonanSymbols,
|
||||
private val moduleFilter: (ModuleDescriptor) -> Boolean
|
||||
) : IrProvider {
|
||||
|
||||
private val symbolTable: SymbolTable = context.symbolTable
|
||||
@@ -65,7 +71,7 @@ internal class IrProviderForCEnumAndCStructStubs(
|
||||
* of enums and structs that should be generated.
|
||||
*/
|
||||
val outputFiles: List<IrFile>
|
||||
get() = filesMap.values.toList()
|
||||
get() = filesMap.filterKeys { moduleFilter(it.module) }.values.toList()
|
||||
|
||||
fun canHandleSymbol(symbol: IrSymbol): Boolean {
|
||||
if (!symbol.isPublicApi) return false
|
||||
|
||||
Reference in New Issue
Block a user