diff options
| author | Erik Desjardins <erikdesjardins@users.noreply.github.com> | 2022-02-26 16:58:45 -0500 |
|---|---|---|
| committer | Erik Desjardins <erikdesjardins@users.noreply.github.com> | 2022-02-26 16:58:45 -0500 |
| commit | ac9f4f7d0de3986246a19678919ff15252870b15 (patch) | |
| tree | 7221bc18728b1afa81c3fe4c2633942b4548125a /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 91e7e8ddcbc16d35a367fda198684a51ee2d0b2b (diff) | |
| download | rust-ac9f4f7d0de3986246a19678919ff15252870b15.tar.gz rust-ac9f4f7d0de3986246a19678919ff15252870b15.zip | |
use attrbuilder to remove attrs in old LLVM
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 632a7985c79..1ba54ca0779 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -250,14 +250,17 @@ template<typename T> static inline void AddAttributes(T *t, unsigned Index, template<typename T> static inline void RemoveAttributes(T *t, unsigned Index, LLVMRustAttribute *RustAttrs, size_t RustAttrsLen) { - AttributeMask Mask; - for (LLVMRustAttribute RustAttr : makeArrayRef(RustAttrs, RustAttrsLen)) - Mask.addAttribute(fromRust(RustAttr)); AttributeList PAL = t->getAttributes(); AttributeList PALNew; #if LLVM_VERSION_LT(14, 0) - PALNew = PAL.removeAttributes(t->getContext(), Index, Mask); + AttrBuilder B(t->getContext()); + for (LLVMRustAttribute RustAttr : makeArrayRef(RustAttrs, RustAttrsLen)) + B.addAttribute(fromRust(RustAttr)); + PALNew = PAL.removeAttributes(t->getContext(), Index, B); #else + AttributeMask Mask; + for (LLVMRustAttribute RustAttr : makeArrayRef(RustAttrs, RustAttrsLen)) + Mask.addAttribute(fromRust(RustAttr)); PALNew = PAL.removeAttributesAtIndex(t->getContext(), Index, Mask); #endif t->setAttributes(PALNew); |
