[K/N] Add -Xllvm-variant` compiler option

We need a handle that allows user to pick `dev` variant instead of
`user` one just in case.
Additionally, I added a possibility to provide a path to an arbitrary
LLVM distribution because it is useful for development purposes.
This commit is contained in:
Sergey Bogolepov
2021-08-12 17:24:34 +07:00
committed by Space
parent db9ff9a4ce
commit c7faf9b4df
5 changed files with 73 additions and 6 deletions
@@ -353,6 +353,20 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
})
arguments.externalDependencies?.let { put(EXTERNAL_DEPENDENCIES, it) }
putIfNotNull(LLVM_VARIANT, when (val variant = arguments.llvmVariant) {
"user" -> LlvmVariant.User
"dev" -> LlvmVariant.Dev
null -> null
else -> {
val file = File(variant)
if (!file.exists) {
configuration.report(ERROR, "`-Xllvm-variant` should be `user`, `dev` or an absolute path. Got: $variant")
null
} else {
LlvmVariant.Custom(file)
}
}
})
}
}
}
@@ -337,6 +337,13 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
)
var workerExceptionHandling: String? = null
@Argument(
value = "-Xllvm-variant",
valueDescription = "{dev|user}",
description = "Choose LLVM distribution which will be used during compilation."
)
var llvmVariant: String? = null
override fun configureAnalysisFlags(collector: MessageCollector, languageVersion: LanguageVersion): MutableMap<AnalysisFlag<*>, Any> =
super.configureAnalysisFlags(collector, languageVersion).also {
val useExperimental = it[AnalysisFlags.useExperimental] as List<*>