Add workaround for KT-35001

Just suppress the warning.
The accident it describes is generally harmless and totally expected.
This commit is contained in:
Svyatoslav Scherbina
2021-04-30 18:50:22 +03:00
committed by teamcityserver
parent 48a684c024
commit ba6c3c7fe0
@@ -8,7 +8,23 @@ package org.jetbrains.kotlin.backend.konan.llvm
import llvm.*
import org.jetbrains.kotlin.backend.konan.Context
internal fun llvmLinkModules2(context: Context, dest: LLVMModuleRef, src: LLVMModuleRef): LLVMBool =
withLlvmDiagnosticHandler(DefaultLlvmDiagnosticHandler(context)) {
LLVMLinkModules2(dest, src)
internal fun llvmLinkModules2(context: Context, dest: LLVMModuleRef, src: LLVMModuleRef): LLVMBool {
val diagnosticHandler = DefaultLlvmDiagnosticHandler(context, object : DefaultLlvmDiagnosticHandler.Policy {
override fun suppressWarning(diagnostic: LlvmDiagnostic): Boolean {
if (super.suppressWarning(diagnostic)) return true
// Workaround https://youtrack.jetbrains.com/issue/KT-35001.
// Note: SDK version mismatch is generally harmless.
// Also it is expected: LLVM bitcode can be built in different environments with different SDK versions,
// and then linked by the compiler altogether.
// Just ignore such warnings for now:
if (diagnostic.message.startsWith("linking module flags 'SDK Version': IDs have conflicting values")) return true
return false
}
})
return withLlvmDiagnosticHandler(diagnosticHandler) {
LLVMLinkModules2(dest, src)
}
}