Skip to content

Commit 79f99e7

Browse files
authored
Rollup merge of rust-lang#105555 - krasimirgg:llvm-int-opt-2, r=cuviper
llvm-wrapper: adapt for LLVM API changes This is a follow-up of rust-lang@75aec47. There, I updated the wrapper to only include llvm/ADT/Optional.h for LLVM version below 16. But I missed updating some of the None references. Found by our experimental rust + llvm at HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/15587#0185006b-e0af-49e5-8b06-280ed125ff0d/200-539
2 parents 6042f5b + cbdc00f commit 79f99e7

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,11 @@ fromRust(LLVMRustCodeModel Model) {
223223
case LLVMRustCodeModel::Large:
224224
return CodeModel::Large;
225225
case LLVMRustCodeModel::None:
226+
#if LLVM_VERSION_LT(16, 0)
226227
return None;
228+
#else
229+
return std::nullopt;
230+
#endif
227231
default:
228232
report_fatal_error("Bad CodeModel.");
229233
}

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,13 @@ extern "C" LLVMAttributeRef LLVMRustCreateUWTableAttr(LLVMContextRef C, bool Asy
322322
}
323323

324324
extern "C" LLVMAttributeRef LLVMRustCreateAllocSizeAttr(LLVMContextRef C, uint32_t ElementSizeArg) {
325-
return wrap(Attribute::getWithAllocSizeArgs(*unwrap(C), ElementSizeArg, None));
325+
return wrap(Attribute::getWithAllocSizeArgs(*unwrap(C), ElementSizeArg,
326+
#if LLVM_VERSION_LT(16, 0)
327+
None
328+
#else
329+
std::nullopt
330+
#endif
331+
));
326332
}
327333

328334
#if LLVM_VERSION_GE(15, 0)
@@ -717,7 +723,11 @@ static std::optional<DIFile::ChecksumKind> fromRust(LLVMRustChecksumKind Kind) {
717723
#endif
718724
switch (Kind) {
719725
case LLVMRustChecksumKind::None:
726+
#if LLVM_VERSION_LT(16, 0)
720727
return None;
728+
#else
729+
return std::nullopt;
730+
#endif
721731
case LLVMRustChecksumKind::MD5:
722732
return DIFile::ChecksumKind::CSK_MD5;
723733
case LLVMRustChecksumKind::SHA1:

0 commit comments

Comments
 (0)