[K/N] Add trivial test for llvm.objc.clang.arc.use lowering

This commit is contained in:
Sergey Bogolepov
2021-08-23 17:04:18 +07:00
committed by TeamCityServer
parent 690d0689a1
commit 9dd8266bee
4 changed files with 58 additions and 0 deletions
@@ -4862,6 +4862,19 @@ if (PlatformInfo.isAppleTarget(project)) {
}
}
}
standaloneTest("objc_arc_contract") {
doBeforeBuild {
mkdir(buildDir)
ExecLlvmKt.execLlvmUtility(project, "llvm-as") {
args "$projectDir/interop/objc_arc_contract/main.ll"
args "-o", "$buildDir/objc_arc_contract.bc"
}
}
source = "interop/objc_arc_contract/main.kt"
goldValue = "ok\n"
flags = ["-native-library", "$buildDir/objc_arc_contract.bc"]
}
}
standaloneTest("jsinterop_math") {
@@ -0,0 +1,10 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
// We don't do anything meaningful here, because the test is actually checks
// how compiler handles external bitcode (see main.ll). So this file is needed only for compiler invocation.
fun main() {
println("ok")
}
@@ -0,0 +1,9 @@
; Prevent function from DCE
@llvm.compiler.used = appending global [1 x i8*] [ i8* bitcast (void (i8*, i8*)* @test to i8*) ], section "llvm.metadata"
declare void @llvm.objc.clang.arc.use(...) nounwind
define void @test(i8* %a, i8* %b) {
call void (...) @llvm.objc.clang.arc.use(i8* %a, i8* %b) nounwind
ret void
}
@@ -0,0 +1,26 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin
import groovy.lang.Closure
import org.gradle.api.Action
import org.gradle.api.Project
import org.gradle.process.ExecResult
import org.gradle.process.ExecSpec
import org.gradle.util.ConfigureUtil
import org.jetbrains.kotlin.konan.util.DependencyProcessor
fun execLlvmUtility(project: Project, utility: String, action: Action<in ExecSpec>): ExecResult {
val llvmBinDirectory = "${project.platformManager.hostPlatform.absoluteLlvmHome}/bin"
return project.exec(Action<ExecSpec> {
action.execute(this)
executable = "$llvmBinDirectory/$utility"
})
}
fun execLlvmUtility(project: Project, utility: String, closure: Closure<in ExecSpec>): ExecResult {
return execLlvmUtility(project, utility, ConfigureUtil.configureUsing(closure))
}