about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorAugie Fackler <augie@google.com>2022-01-04 13:41:36 -0500
committerAugie Fackler <augie@google.com>2022-01-04 13:50:02 -0500
commit2803fbc44758a795d48a0c2d3a8ee06045dc9efb (patch)
tree5aadc848d4574b3dfa731226bb136b148d3519a3 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent2b681ac06b1a6b7ea39525e59363ffee0d1a68e5 (diff)
downloadrust-2803fbc44758a795d48a0c2d3a8ee06045dc9efb.tar.gz
rust-2803fbc44758a795d48a0c2d3a8ee06045dc9efb.zip
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.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index 025a0ee376e..84db11efe30 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -342,13 +342,15 @@ extern "C" void LLVMRustRemoveFunctionAttributes(LLVMValueRef Fn,
                                                  LLVMRustAttribute RustAttr) {
   Function *F = unwrap<Function>(Fn);
   Attribute Attr = Attribute::get(F->getContext(), fromRust(RustAttr));
-  AttrBuilder B(Attr);
   auto PAL = F->getAttributes();
   AttributeList PALNew;
 #if LLVM_VERSION_LT(14, 0)
+  AttrBuilder B(Attr);
   PALNew = PAL.removeAttributes(F->getContext(), Index, B);
 #else
-  PALNew = PAL.removeAttributesAtIndex(F->getContext(), Index, B);
+  AttributeMask M;
+  M.addAttribute(Attr);
+  PALNew = PAL.removeAttributesAtIndex(F->getContext(), Index, M);
 #endif
   F->setAttributes(PALNew);
 }