@@ -230,29 +230,33 @@ class AttributeSet {
230
230
231
231
// / Add an argument attribute. Returns a new set because attribute sets are
232
232
// / immutable.
233
- AttributeSet addAttribute (LLVMContext &C, Attribute::AttrKind Kind) const ;
233
+ LLVM_NODISCARD AttributeSet addAttribute (LLVMContext &C,
234
+ Attribute::AttrKind Kind) const ;
234
235
235
236
// / Add a target-dependent attribute. Returns a new set because attribute sets
236
237
// / are immutable.
237
- AttributeSet addAttribute (LLVMContext &C, StringRef Kind,
238
- StringRef Value = StringRef()) const ;
238
+ LLVM_NODISCARD AttributeSet addAttribute (LLVMContext &C, StringRef Kind,
239
+ StringRef Value = StringRef()) const ;
239
240
240
241
// / Add attributes to the attribute set. Returns a new set because attribute
241
242
// / sets are immutable.
242
- AttributeSet addAttributes (LLVMContext &C, AttributeSet AS) const ;
243
+ LLVM_NODISCARD AttributeSet addAttributes (LLVMContext &C,
244
+ AttributeSet AS) const ;
243
245
244
246
// / Remove the specified attribute from this set. Returns a new set because
245
247
// / attribute sets are immutable.
246
- AttributeSet removeAttribute (LLVMContext &C, Attribute::AttrKind Kind) const ;
248
+ LLVM_NODISCARD AttributeSet removeAttribute (LLVMContext &C,
249
+ Attribute::AttrKind Kind) const ;
247
250
248
251
// / Remove the specified attribute from this set. Returns a new set because
249
252
// / attribute sets are immutable.
250
- AttributeSet removeAttribute (LLVMContext &C, StringRef Kind) const ;
253
+ LLVM_NODISCARD AttributeSet removeAttribute (LLVMContext &C,
254
+ StringRef Kind) const ;
251
255
252
256
// / Remove the specified attributes from this set. Returns a new set because
253
257
// / attribute sets are immutable.
254
- AttributeSet removeAttributes (LLVMContext &C,
255
- const AttrBuilder &AttrsToRemove) const ;
258
+ LLVM_NODISCARD AttributeSet
259
+ removeAttributes (LLVMContext &C, const AttrBuilder &AttrsToRemove) const ;
256
260
257
261
// / Return the number of attributes in this set.
258
262
unsigned getNumAttributes () const ;
@@ -375,133 +379,140 @@ class AttributeList {
375
379
376
380
// / Add an attribute to the attribute set at the given index.
377
381
// / Returns a new list because attribute lists are immutable.
378
- AttributeList addAttribute (LLVMContext &C, unsigned Index,
379
- Attribute::AttrKind Kind) const ;
382
+ LLVM_NODISCARD AttributeList addAttribute (LLVMContext &C, unsigned Index,
383
+ Attribute::AttrKind Kind) const ;
380
384
381
385
// / Add an attribute to the attribute set at the given index.
382
386
// / Returns a new list because attribute lists are immutable.
383
- AttributeList addAttribute (LLVMContext &C, unsigned Index, StringRef Kind,
384
- StringRef Value = StringRef()) const ;
387
+ LLVM_NODISCARD AttributeList
388
+ addAttribute (LLVMContext &C, unsigned Index, StringRef Kind,
389
+ StringRef Value = StringRef()) const ;
385
390
386
391
// / Add an attribute to the attribute set at the given index.
387
392
// / Returns a new list because attribute lists are immutable.
388
- AttributeList addAttribute (LLVMContext &C, unsigned Index, Attribute A) const ;
393
+ LLVM_NODISCARD AttributeList addAttribute (LLVMContext &C, unsigned Index,
394
+ Attribute A) const ;
389
395
390
396
// / Add attributes to the attribute set at the given index.
391
397
// / Returns a new list because attribute lists are immutable.
392
- AttributeList addAttributes (LLVMContext &C, unsigned Index,
393
- const AttrBuilder &B) const ;
398
+ LLVM_NODISCARD AttributeList addAttributes (LLVMContext &C, unsigned Index,
399
+ const AttrBuilder &B) const ;
394
400
395
401
// / Add an argument attribute to the list. Returns a new list because
396
402
// / attribute lists are immutable.
397
- AttributeList addParamAttribute (LLVMContext &C, unsigned ArgNo,
398
- Attribute::AttrKind Kind) const {
403
+ LLVM_NODISCARD AttributeList addParamAttribute (
404
+ LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const {
399
405
return addAttribute (C, ArgNo + FirstArgIndex, Kind);
400
406
}
401
407
402
408
// / Add an argument attribute to the list. Returns a new list because
403
409
// / attribute lists are immutable.
404
- AttributeList addParamAttribute (LLVMContext &C, unsigned ArgNo,
405
- StringRef Kind,
406
- StringRef Value = StringRef()) const {
410
+ LLVM_NODISCARD AttributeList
411
+ addParamAttribute (LLVMContext &C, unsigned ArgNo, StringRef Kind,
412
+ StringRef Value = StringRef()) const {
407
413
return addAttribute (C, ArgNo + FirstArgIndex, Kind, Value);
408
414
}
409
415
410
416
// / Add an attribute to the attribute list at the given arg indices. Returns a
411
417
// / new list because attribute lists are immutable.
412
- AttributeList addParamAttribute (LLVMContext &C, ArrayRef<unsigned > ArgNos,
413
- Attribute A) const ;
418
+ LLVM_NODISCARD AttributeList addParamAttribute (LLVMContext &C,
419
+ ArrayRef<unsigned > ArgNos,
420
+ Attribute A) const ;
414
421
415
422
// / Add an argument attribute to the list. Returns a new list because
416
423
// / attribute lists are immutable.
417
- AttributeList addParamAttributes (LLVMContext &C, unsigned ArgNo,
418
- const AttrBuilder &B) const {
424
+ LLVM_NODISCARD AttributeList addParamAttributes (LLVMContext &C,
425
+ unsigned ArgNo,
426
+ const AttrBuilder &B) const {
419
427
return addAttributes (C, ArgNo + FirstArgIndex, B);
420
428
}
421
429
422
430
// / Remove the specified attribute at the specified index from this
423
431
// / attribute list. Returns a new list because attribute lists are immutable.
424
- AttributeList removeAttribute (LLVMContext &C, unsigned Index,
425
- Attribute::AttrKind Kind) const ;
432
+ LLVM_NODISCARD AttributeList removeAttribute (LLVMContext &C, unsigned Index,
433
+ Attribute::AttrKind Kind) const ;
426
434
427
435
// / Remove the specified attribute at the specified index from this
428
436
// / attribute list. Returns a new list because attribute lists are immutable.
429
- AttributeList removeAttribute (LLVMContext &C, unsigned Index,
430
- StringRef Kind) const ;
437
+ LLVM_NODISCARD AttributeList removeAttribute (LLVMContext &C, unsigned Index,
438
+ StringRef Kind) const ;
431
439
432
440
// / Remove the specified attributes at the specified index from this
433
441
// / attribute list. Returns a new list because attribute lists are immutable.
434
- AttributeList removeAttributes (LLVMContext &C, unsigned Index,
435
- const AttrBuilder &AttrsToRemove) const ;
442
+ LLVM_NODISCARD AttributeList removeAttributes (
443
+ LLVMContext &C, unsigned Index, const AttrBuilder &AttrsToRemove) const ;
436
444
437
445
// / Remove all attributes at the specified index from this
438
446
// / attribute list. Returns a new list because attribute lists are immutable.
439
- AttributeList removeAttributes (LLVMContext &C, unsigned Index) const ;
447
+ LLVM_NODISCARD AttributeList removeAttributes (LLVMContext &C,
448
+ unsigned Index) const ;
440
449
441
450
// / Remove the specified attribute at the specified arg index from this
442
451
// / attribute list. Returns a new list because attribute lists are immutable.
443
- AttributeList removeParamAttribute (LLVMContext &C, unsigned ArgNo,
444
- Attribute::AttrKind Kind) const {
452
+ LLVM_NODISCARD AttributeList removeParamAttribute (
453
+ LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const {
445
454
return removeAttribute (C, ArgNo + FirstArgIndex, Kind);
446
455
}
447
456
448
457
// / Remove the specified attribute at the specified arg index from this
449
458
// / attribute list. Returns a new list because attribute lists are immutable.
450
- AttributeList removeParamAttribute (LLVMContext &C, unsigned ArgNo,
451
- StringRef Kind) const {
459
+ LLVM_NODISCARD AttributeList removeParamAttribute (LLVMContext &C,
460
+ unsigned ArgNo,
461
+ StringRef Kind) const {
452
462
return removeAttribute (C, ArgNo + FirstArgIndex, Kind);
453
463
}
454
464
455
465
// / Remove the specified attribute at the specified arg index from this
456
466
// / attribute list. Returns a new list because attribute lists are immutable.
457
- AttributeList removeParamAttributes (LLVMContext &C, unsigned ArgNo,
458
- const AttrBuilder &AttrsToRemove) const {
467
+ LLVM_NODISCARD AttributeList removeParamAttributes (
468
+ LLVMContext &C, unsigned ArgNo, const AttrBuilder &AttrsToRemove) const {
459
469
return removeAttributes (C, ArgNo + FirstArgIndex, AttrsToRemove);
460
470
}
461
471
462
472
// / Remove all attributes at the specified arg index from this
463
473
// / attribute list. Returns a new list because attribute lists are immutable.
464
- AttributeList removeParamAttributes (LLVMContext &C, unsigned ArgNo) const {
474
+ LLVM_NODISCARD AttributeList removeParamAttributes (LLVMContext &C,
475
+ unsigned ArgNo) const {
465
476
return removeAttributes (C, ArgNo + FirstArgIndex);
466
477
}
467
478
468
479
// / \brief Add the dereferenceable attribute to the attribute set at the given
469
480
// / index. Returns a new list because attribute lists are immutable.
470
- AttributeList addDereferenceableAttr (LLVMContext &C, unsigned Index,
471
- uint64_t Bytes) const ;
481
+ LLVM_NODISCARD AttributeList addDereferenceableAttr (LLVMContext &C,
482
+ unsigned Index,
483
+ uint64_t Bytes) const ;
472
484
473
485
// / \brief Add the dereferenceable attribute to the attribute set at the given
474
486
// / arg index. Returns a new list because attribute lists are immutable.
475
- AttributeList addDereferenceableParamAttr (LLVMContext &C, unsigned ArgNo,
476
- uint64_t Bytes) const {
487
+ LLVM_NODISCARD AttributeList addDereferenceableParamAttr (
488
+ LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const {
477
489
return addDereferenceableAttr (C, ArgNo + FirstArgIndex, Bytes);
478
490
}
479
491
480
492
// / Add the dereferenceable_or_null attribute to the attribute set at
481
493
// / the given index. Returns a new list because attribute lists are immutable.
482
- AttributeList addDereferenceableOrNullAttr (LLVMContext &C, unsigned Index,
483
- uint64_t Bytes) const ;
494
+ LLVM_NODISCARD AttributeList addDereferenceableOrNullAttr (
495
+ LLVMContext &C, unsigned Index, uint64_t Bytes) const ;
484
496
485
497
// / Add the dereferenceable_or_null attribute to the attribute set at
486
498
// / the given arg index. Returns a new list because attribute lists are
487
499
// / immutable.
488
- AttributeList addDereferenceableOrNullParamAttr (LLVMContext &C,
489
- unsigned ArgNo,
490
- uint64_t Bytes) const {
500
+ LLVM_NODISCARD AttributeList addDereferenceableOrNullParamAttr (
501
+ LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const {
491
502
return addDereferenceableOrNullAttr (C, ArgNo + FirstArgIndex, Bytes);
492
503
}
493
504
494
505
// / Add the allocsize attribute to the attribute set at the given index.
495
506
// / Returns a new list because attribute lists are immutable.
496
- AttributeList addAllocSizeAttr (LLVMContext &C, unsigned Index,
497
- unsigned ElemSizeArg,
498
- const Optional<unsigned > &NumElemsArg);
507
+ LLVM_NODISCARD AttributeList
508
+ addAllocSizeAttr (LLVMContext &C, unsigned Index, unsigned ElemSizeArg,
509
+ const Optional<unsigned > &NumElemsArg);
499
510
500
511
// / Add the allocsize attribute to the attribute set at the given arg index.
501
512
// / Returns a new list because attribute lists are immutable.
502
- AttributeList addAllocSizeParamAttr (LLVMContext &C, unsigned ArgNo,
503
- unsigned ElemSizeArg,
504
- const Optional<unsigned > &NumElemsArg) {
513
+ LLVM_NODISCARD AttributeList
514
+ addAllocSizeParamAttr (LLVMContext &C, unsigned ArgNo, unsigned ElemSizeArg,
515
+ const Optional<unsigned > &NumElemsArg) {
505
516
return addAllocSizeAttr (C, ArgNo + FirstArgIndex, ElemSizeArg, NumElemsArg);
506
517
}
507
518
0 commit comments