Replace API level codename with number
This CL fixes a bug when Soong pass `-target` with a non-digit suffix in Clang. As mentioned in b/236753843, Clang's version parsing expects to see an integer in the target string so it ignores the
S suffix.
Test: m gwp_asan_crash_handler && make sure -target is aarch64-linux-androidS instead of aarch64-linux-android31
Test: go test -run ^TestNonDigitMinSdkVersionInClangTriple$ android/soong/cc
Bug: 236753843
Change-Id: I258ecc52083dbf3471d23cf310e0ad54440f1908
diff --git a/cc/compiler.go b/cc/compiler.go
index cd1d92c..72797eb 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -457,7 +457,8 @@
if version == "" || version == "current" {
target += strconv.Itoa(android.FutureApiLevelInt)
} else {
- target += version
+ apiLevel := nativeApiLevelOrPanic(ctx, version)
+ target += apiLevel.String()
}
}