Pin targets using LLVM10 and LLVM16 to C++20
In older LLVMs, certain classes had forward declarations. They do
not work anymore with C++23 because unique_ptr is constexpr now so it
needs the full type defined before being passed to unique_ptr. As a
result, we see bunch of 'invalid application of sizeof to an incomplete
type' errors. These are fixed in more recent version of LLVM but these
libLLVM are fixed to specific versions so it is best to pin these to
C++20.
Flag: EXEMPT PURE_REFACTOR
Bug: 429048222
Test: m libLLVM10_swiftshader libLLVM16_swiftshader in Android
Test: m libswiftshadervk_llvm libswiftshadervk_llvm_debug in Android
Change-Id: I00d8d0667e413e652d1f2869e52b23a8fe5e705b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/77048
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@google.com>
Tested-by: Yuly Novikov <ynovikov@chromium.org>
diff --git a/src/Android.bp b/src/Android.bp
index bd9e725..d60b53a 100644
--- a/src/Android.bp
+++ b/src/Android.bp
@@ -60,6 +60,10 @@
"libcutils",
"liblog",
],
+
+ // Pinning the repo to C++20 because LLVM 16 has many forward declarations
+ // without full type being defined which causes issues with C++23
+ cpp_std: "c++20",
}
cc_library_static {
diff --git a/third_party/llvm-10.0/Android.bp b/third_party/llvm-10.0/Android.bp
index f1a8646..71fd79f 100644
--- a/third_party/llvm-10.0/Android.bp
+++ b/third_party/llvm-10.0/Android.bp
@@ -1061,6 +1061,10 @@
// b/193198227
hwaddress: false,
},
+
+ // Pinning the repo to C++20 because LLVM 10 has many forward declarations
+ // without full type being defined which causes issues with C++23
+ cpp_std: "c++20",
}
cc_library_static {
diff --git a/third_party/llvm-16.0/Android.bp b/third_party/llvm-16.0/Android.bp
index 06be43c..75e5bc7 100644
--- a/third_party/llvm-16.0/Android.bp
+++ b/third_party/llvm-16.0/Android.bp
@@ -1518,6 +1518,10 @@
// b/193198227
hwaddress: false,
},
+
+ // Pinning the repo to C++20 because LLVM 16 has many forward declarations
+ // without full type being defined which causes issues with C++23
+ cpp_std: "c++20",
}
cc_library_static {