@@ -270,34 +270,30 @@ extern "C" void LLVMRustAddFunctionAttribute(LLVMValueRef Fn, unsigned Index,
270
270
LLVMRustAttribute RustAttr) {
271
271
Function *A = unwrap<Function>(Fn);
272
272
Attribute Attr = Attribute::get (A->getContext (), fromRust (RustAttr));
273
- AttrBuilder B (Attr);
274
- A->addAttributes (Index, B);
273
+ A->addAttribute (Index, Attr);
275
274
}
276
275
277
276
extern " C" void LLVMRustAddAlignmentAttr (LLVMValueRef Fn,
278
277
unsigned Index,
279
278
uint32_t Bytes) {
280
279
Function *A = unwrap<Function>(Fn);
281
- AttrBuilder B;
282
- B.addAlignmentAttr (Bytes);
283
- A->addAttributes (Index, B);
280
+ A->addAttribute (Index, Attribute::getWithAlignment (
281
+ A->getContext (), llvm::Align (Bytes)));
284
282
}
285
283
286
284
extern " C" void LLVMRustAddDereferenceableAttr (LLVMValueRef Fn, unsigned Index,
287
285
uint64_t Bytes) {
288
286
Function *A = unwrap<Function>(Fn);
289
- AttrBuilder B;
290
- B.addDereferenceableAttr (Bytes);
291
- A->addAttributes (Index, B);
287
+ A->addAttribute (Index, Attribute::getWithDereferenceableBytes (A->getContext (),
288
+ Bytes));
292
289
}
293
290
294
291
extern " C" void LLVMRustAddDereferenceableOrNullAttr (LLVMValueRef Fn,
295
292
unsigned Index,
296
293
uint64_t Bytes) {
297
294
Function *A = unwrap<Function>(Fn);
298
- AttrBuilder B;
299
- B.addDereferenceableOrNullAttr (Bytes);
300
- A->addAttributes (Index, B);
295
+ A->addAttribute (Index, Attribute::getWithDereferenceableOrNullBytes (
296
+ A->getContext (), Bytes));
301
297
}
302
298
303
299
extern " C" void LLVMRustAddByValAttr (LLVMValueRef Fn, unsigned Index,
@@ -323,9 +319,8 @@ extern "C" void LLVMRustAddFunctionAttrStringValue(LLVMValueRef Fn,
323
319
const char *Name,
324
320
const char *Value) {
325
321
Function *F = unwrap<Function>(Fn);
326
- AttrBuilder B;
327
- B.addAttribute (Name, Value);
328
- F->addAttributes (Index, B);
322
+ F->addAttribute (Index, Attribute::get (
323
+ F->getContext (), StringRef (Name), StringRef (Value)));
329
324
}
330
325
331
326
extern " C" void LLVMRustRemoveFunctionAttributes (LLVMValueRef Fn,
0 commit comments