mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-06 02:45:25 +03:00
Fix some more deprecations with LLVM 16 (#4185)
This commit is contained in:
parent
f27b9461b8
commit
19e7024377
2 changed files with 22 additions and 1 deletions
|
@ -321,14 +321,30 @@ void outputIR2ObjRelevantCmdlineArgs(llvm::raw_ostream &hash_os) {
|
|||
hash_os << opts::getFeaturesStr();
|
||||
hash_os << opts::floatABI;
|
||||
const auto relocModel = opts::getRelocModel();
|
||||
#if LDC_LLVM_VER >= 1600
|
||||
if (relocModel.has_value())
|
||||
hash_os << relocModel.value();
|
||||
#else
|
||||
if (relocModel.hasValue())
|
||||
hash_os << relocModel.getValue();
|
||||
#endif
|
||||
const auto codeModel = opts::getCodeModel();
|
||||
#if LDC_LLVM_VER >= 1600
|
||||
if (codeModel.has_value())
|
||||
hash_os << codeModel.value();
|
||||
#else
|
||||
if (codeModel.hasValue())
|
||||
hash_os << codeModel.getValue();
|
||||
#endif
|
||||
|
||||
const auto framePointerUsage = opts::framePointerUsage();
|
||||
#if LDC_LLVM_VER >= 1600
|
||||
if (framePointerUsage.has_value())
|
||||
hash_os << static_cast<int>(framePointerUsage.value());
|
||||
#else
|
||||
if (framePointerUsage.hasValue())
|
||||
hash_os << static_cast<int>(framePointerUsage.getValue());
|
||||
#endif
|
||||
}
|
||||
|
||||
// Output to `hash_os` all environment flags that influence object code output
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue