[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:
@@ -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)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -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<*>
|
||||
|
||||
Reference in New Issue
Block a user