Add warning if both -Xuse-ir and -Xuse-old-backend are passed

This commit is contained in:
Alexander Udalov
2021-01-07 22:58:04 +01:00
parent cb3191769d
commit 12078666c2
5 changed files with 23 additions and 0 deletions
@@ -171,6 +171,16 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
} else {
arguments.useIR && !arguments.useOldBackend
}
if (arguments.useIR && arguments.useOldBackend) {
messageCollector.report(
STRONG_WARNING,
"Both -Xuse-ir and -Xuse-old-backend are passed. This is an inconsistent configuration. " +
"The compiler will use the ${if (useIR) "JVM IR" else "old JVM"} backend"
)
}
messageCollector.report(LOGGING, "Using ${if (useIR) "JVM IR" else "old JVM"} backend")
put(JVMConfigurationKeys.IR, useIR)
val abiStability = JvmAbiStability.fromStringOrNull(arguments.abiStability)
+5
View File
@@ -0,0 +1,5 @@
$TESTDATA_DIR$/simple.kt
-d
$TEMP_DIR$
-Xuse-ir
-Xuse-old-backend
+2
View File
@@ -0,0 +1,2 @@
warning: both -Xuse-ir and -Xuse-old-backend are passed. This is an inconsistent configuration. The compiler will use the old JVM backend
OK
@@ -4,6 +4,7 @@ Buildfile: [TestData]/build.xml
build:
[kotlinc] Compiling [[TestData]/hello.kt] => [[Temp]/hello.jar]
[kotlinc] logging: using Kotlin home directory [KotlinProjectHome]/dist/kotlinc
[kotlinc] logging: using old JVM backend
[kotlinc] logging: configuring the compilation environment
[kotlinc] logging: configure scripting: Added template org.jetbrains.kotlin.mainKts.MainKtsScript from [[CompilerLib]/kotlin-main-kts.jar, [CompilerLib]/kotlin-reflect.jar, [CompilerLib]/kotlin-script-runtime.jar, [CompilerLib]/kotlin-stdlib.jar]
@@ -101,6 +101,11 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/jvm/argumentPassedMultipleTimes.args");
}
@TestMetadata("bothJvmIrAndOldBackend.args")
public void testBothJvmIrAndOldBackend() throws Exception {
runTest("compiler/testData/cli/jvm/bothJvmIrAndOldBackend.args");
}
@TestMetadata("classAndFileClassClash.args")
public void testClassAndFileClassClash() throws Exception {
runTest("compiler/testData/cli/jvm/classAndFileClassClash.args");