LLVM changed the nocapture attribute to captures(none)
This updates RustWrapper.cpp and tests after https://github.com/llvm/llvm-project/pull/123181
This commit is contained in:
parent
e6f12c8b7d
commit
23fb08bb53
8 changed files with 36 additions and 18 deletions
|
@ -319,7 +319,11 @@ static Attribute::AttrKind fromRust(LLVMRustAttributeKind Kind) {
|
|||
case LLVMRustAttributeKind::NoAlias:
|
||||
return Attribute::NoAlias;
|
||||
case LLVMRustAttributeKind::NoCapture:
|
||||
#if LLVM_VERSION_GE(21, 0)
|
||||
report_fatal_error("NoCapture doesn't exist in LLVM 21");
|
||||
#else
|
||||
return Attribute::NoCapture;
|
||||
#endif
|
||||
case LLVMRustAttributeKind::NoCfCheck:
|
||||
return Attribute::NoCfCheck;
|
||||
case LLVMRustAttributeKind::NoInline:
|
||||
|
@ -431,6 +435,13 @@ extern "C" void LLVMRustEraseInstFromParent(LLVMValueRef Instr) {
|
|||
|
||||
extern "C" LLVMAttributeRef
|
||||
LLVMRustCreateAttrNoValue(LLVMContextRef C, LLVMRustAttributeKind RustAttr) {
|
||||
#if LLVM_VERSION_GE(21, 0)
|
||||
// LLVM 21 replaced the NoCapture attribute with Captures(none).
|
||||
if (RustAttr == LLVMRustAttributeKind::NoCapture) {
|
||||
return wrap(Attribute::get(*unwrap(C), Attribute::Captures,
|
||||
CaptureInfo::none().toIntValue()));
|
||||
}
|
||||
#endif
|
||||
return wrap(Attribute::get(*unwrap(C), fromRust(RustAttr)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue