RustWrapper: adapt to new AttributeMask API
Upstream LLVM change 9290ccc3c1a1 migrated attribute removal to use AttributeMask instead of AttrBuilder, so we need to follow suit here.
This commit is contained in:
parent
2b681ac06b
commit
2803fbc447
1 changed files with 4 additions and 2 deletions
|
@ -342,13 +342,15 @@ extern "C" void LLVMRustRemoveFunctionAttributes(LLVMValueRef Fn,
|
||||||
LLVMRustAttribute RustAttr) {
|
LLVMRustAttribute RustAttr) {
|
||||||
Function *F = unwrap<Function>(Fn);
|
Function *F = unwrap<Function>(Fn);
|
||||||
Attribute Attr = Attribute::get(F->getContext(), fromRust(RustAttr));
|
Attribute Attr = Attribute::get(F->getContext(), fromRust(RustAttr));
|
||||||
AttrBuilder B(Attr);
|
|
||||||
auto PAL = F->getAttributes();
|
auto PAL = F->getAttributes();
|
||||||
AttributeList PALNew;
|
AttributeList PALNew;
|
||||||
#if LLVM_VERSION_LT(14, 0)
|
#if LLVM_VERSION_LT(14, 0)
|
||||||
|
AttrBuilder B(Attr);
|
||||||
PALNew = PAL.removeAttributes(F->getContext(), Index, B);
|
PALNew = PAL.removeAttributes(F->getContext(), Index, B);
|
||||||
#else
|
#else
|
||||||
PALNew = PAL.removeAttributesAtIndex(F->getContext(), Index, B);
|
AttributeMask M;
|
||||||
|
M.addAttribute(Attr);
|
||||||
|
PALNew = PAL.removeAttributesAtIndex(F->getContext(), Index, M);
|
||||||
#endif
|
#endif
|
||||||
F->setAttributes(PALNew);
|
F->setAttributes(PALNew);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue