@@ -225,41 +225,28 @@ extern "C" void LLVMRustAddCallSiteAttrString(LLVMValueRef Instr, unsigned Index
225
225
AddAttribute (Call, Index, Attr);
226
226
}
227
227
228
- static inline void AddCallAttributes (CallBase *Call, unsigned Index, const AttrBuilder& B) {
229
- AttributeList Attrs = Call->getAttributes ();
230
- #if LLVM_VERSION_LT(14, 0)
231
- Attrs = Attrs.addAttributes (Call->getContext (), Index, B);
232
- #else
233
- Attrs = Attrs.addAttributesAtIndex (Call->getContext (), Index, B);
234
- #endif
235
- Call->setAttributes (Attrs);
236
- }
237
-
238
228
extern " C" void LLVMRustAddAlignmentCallSiteAttr (LLVMValueRef Instr,
239
229
unsigned Index,
240
230
uint32_t Bytes) {
241
231
CallBase *Call = unwrap<CallBase>(Instr);
242
- AttrBuilder B;
243
- B.addAlignmentAttr (Bytes);
244
- AddCallAttributes (Call, Index, B);
232
+ Attribute Attr = Attribute::getWithAlignment (Call->getContext (), Align (Bytes));
233
+ AddAttribute (Call, Index, Attr);
245
234
}
246
235
247
236
extern " C" void LLVMRustAddDereferenceableCallSiteAttr (LLVMValueRef Instr,
248
237
unsigned Index,
249
238
uint64_t Bytes) {
250
239
CallBase *Call = unwrap<CallBase>(Instr);
251
- AttrBuilder B;
252
- B.addDereferenceableAttr (Bytes);
253
- AddCallAttributes (Call, Index, B);
240
+ Attribute Attr = Attribute::getWithDereferenceableBytes (Call->getContext (), Bytes);
241
+ AddAttribute (Call, Index, Attr);
254
242
}
255
243
256
244
extern " C" void LLVMRustAddDereferenceableOrNullCallSiteAttr (LLVMValueRef Instr,
257
245
unsigned Index,
258
246
uint64_t Bytes) {
259
247
CallBase *Call = unwrap<CallBase>(Instr);
260
- AttrBuilder B;
261
- B.addDereferenceableOrNullAttr (Bytes);
262
- AddCallAttributes (Call, Index, B);
248
+ Attribute Attr = Attribute::getWithDereferenceableOrNullBytes (Call->getContext (), Bytes);
249
+ AddAttribute (Call, Index, Attr);
263
250
}
264
251
265
252
extern " C" void LLVMRustAddByValCallSiteAttr (LLVMValueRef Instr, unsigned Index,
0 commit comments