Add a separate compiler switch for runtime asserts

This commit is contained in:
Alexander Shabalin
2021-07-28 07:43:08 +00:00
committed by Space
parent c3515cc338
commit 48a2b23b3a
18 changed files with 199 additions and 104 deletions
@@ -321,6 +321,15 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
true
}
})
put(RUNTIME_ASSERTS_MODE, when (arguments.runtimeAssertsMode) {
"ignore" -> RuntimeAssertsMode.IGNORE
"log" -> RuntimeAssertsMode.LOG
"panic" -> RuntimeAssertsMode.PANIC
else -> {
configuration.report(ERROR, "Unsupported runtime asserts mode ${arguments.runtimeAssertsMode}")
RuntimeAssertsMode.IGNORE
}
})
}
}
}
@@ -321,6 +321,9 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
)
var checkLldCompatibility: String? = null
@Argument(value="-Xruntime-asserts-mode", valueDescription = "<mode>", description = "Enable asserts in runtime. Possible values: 'ignore', 'log', 'panic'")
var runtimeAssertsMode: String? = "ignore"
override fun configureAnalysisFlags(collector: MessageCollector, languageVersion: LanguageVersion): MutableMap<AnalysisFlag<*>, Any> =
super.configureAnalysisFlags(collector, languageVersion).also {
val useExperimental = it[AnalysisFlags.useExperimental] as List<*>