Skip to content

Commit

Permalink
Rollup merge of rust-lang#92559 - durin42:llvm-14-attributemask, r=nikic
Browse files Browse the repository at this point in the history
RustWrapper: adapt to new AttributeMask API

Upstream LLVM change 9290ccc migrated attribute removal to use
AttributeMask instead of AttrBuilder, so we need to follow suit here.

r? `@nagisa` cc `@nikic`
  • Loading branch information
matthiaskrgr authored Jan 6, 2022
2 parents 7ddd851 + 34a6b6c commit 1e234f9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 1e234f9

Please sign in to comment.