use attrbuilder to remove attrs in old LLVM
This commit is contained in:
parent
91e7e8ddcb
commit
ac9f4f7d0d
1 changed files with 7 additions and 4 deletions
|
@ -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,
|
template<typename T> static inline void RemoveAttributes(T *t, unsigned Index,
|
||||||
LLVMRustAttribute *RustAttrs,
|
LLVMRustAttribute *RustAttrs,
|
||||||
size_t RustAttrsLen) {
|
size_t RustAttrsLen) {
|
||||||
AttributeMask Mask;
|
|
||||||
for (LLVMRustAttribute RustAttr : makeArrayRef(RustAttrs, RustAttrsLen))
|
|
||||||
Mask.addAttribute(fromRust(RustAttr));
|
|
||||||
AttributeList PAL = t->getAttributes();
|
AttributeList PAL = t->getAttributes();
|
||||||
AttributeList PALNew;
|
AttributeList PALNew;
|
||||||
#if LLVM_VERSION_LT(14, 0)
|
#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
|
#else
|
||||||
|
AttributeMask Mask;
|
||||||
|
for (LLVMRustAttribute RustAttr : makeArrayRef(RustAttrs, RustAttrsLen))
|
||||||
|
Mask.addAttribute(fromRust(RustAttr));
|
||||||
PALNew = PAL.removeAttributesAtIndex(t->getContext(), Index, Mask);
|
PALNew = PAL.removeAttributesAtIndex(t->getContext(), Index, Mask);
|
||||||
#endif
|
#endif
|
||||||
t->setAttributes(PALNew);
|
t->setAttributes(PALNew);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue