Rollup merge of #92559 - durin42:llvm-14-attributemask, r=nikic

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.

r? ``@nagisa`` cc ``@nikic``
This commit is contained in:
Matthias Krüger 2022-01-06 23:15:18 +01:00 committed by GitHub
commit 1591dcb659
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -341,14 +341,12 @@ extern "C" void LLVMRustRemoveFunctionAttributes(LLVMValueRef Fn,
unsigned Index,
LLVMRustAttribute RustAttr) {
Function *F = unwrap<Function>(Fn);
Attribute Attr = Attribute::get(F->getContext(), fromRust(RustAttr));
AttrBuilder B(Attr);
auto PAL = F->getAttributes();
AttributeList PAL = F->getAttributes();
AttributeList PALNew;
#if LLVM_VERSION_LT(14, 0)
PALNew = PAL.removeAttributes(F->getContext(), Index, B);
PALNew = PAL.removeAttribute(F->getContext(), Index, fromRust(RustAttr));
#else
PALNew = PAL.removeAttributesAtIndex(F->getContext(), Index, B);
PALNew = PAL.removeAttributeAtIndex(F->getContext(), Index, fromRust(RustAttr));
#endif
F->setAttributes(PALNew);
}