Fix some more deprecations with LLVM 16 (#4185)

This commit is contained in:
Nicholas Wilson 2022-09-18 08:00:30 +08:00 committed by GitHub
parent f27b9461b8
commit 19e7024377
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View file

@ -426,7 +426,12 @@ createTargetMachine(const std::string targetTriple, const std::string arch,
}
// Handle cases where LLVM picks wrong default relocModel
if (!relocModel.hasValue()) {
#if LDC_LLVM_VER >= 1600
if (relocModel.has_value()) {}
#else
if (relocModel.hasValue()) {}
#endif
else {
if (triple.isOSDarwin()) {
// Darwin defaults to PIC (and as of 10.7.5/LLVM 3.1-3.3, TLS use leads
// to crashes for non-PIC code). LLVM doesn't handle this.