RustWrapper: simplify removing attributes
Avoids some extra conversions. Spotted by nikic during review.
This commit is contained in:
parent
2803fbc447
commit
34a6b6c423
@ -341,16 +341,12 @@ extern "C" void LLVMRustRemoveFunctionAttributes(LLVMValueRef Fn,
|
|||||||
unsigned Index,
|
unsigned Index,
|
||||||
LLVMRustAttribute RustAttr) {
|
LLVMRustAttribute RustAttr) {
|
||||||
Function *F = unwrap<Function>(Fn);
|
Function *F = unwrap<Function>(Fn);
|
||||||
Attribute Attr = Attribute::get(F->getContext(), fromRust(RustAttr));
|
AttributeList 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.removeAttribute(F->getContext(), Index, fromRust(RustAttr));
|
||||||
PALNew = PAL.removeAttributes(F->getContext(), Index, B);
|
|
||||||
#else
|
#else
|
||||||
AttributeMask M;
|
PALNew = PAL.removeAttributeAtIndex(F->getContext(), Index, fromRust(RustAttr));
|
||||||
M.addAttribute(Attr);
|
|
||||||
PALNew = PAL.removeAttributesAtIndex(F->getContext(), Index, M);
|
|
||||||
#endif
|
#endif
|
||||||
F->setAttributes(PALNew);
|
F->setAttributes(PALNew);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user