Many functions on llvm::AttributeList and llvm::AttributeSet are
documented with "returns a new {list,set} because attribute
{lists,sets} are immutable." This documentation can be aided by the
addition of an attribute, LLVM_NODISCARD. Adding this prevents
unsuspecting users of the API from expecting
AttributeList::setAttributes from modifying the underlying list.
At the very least, it would have saved me a few hours of debugging, since I
had been doing just that! I had a bug in my program where I was calling
setAttributes but then passing in the unmutated AttributeList.
I tried adding LLVM_NODISCARD and confirmed that it would have made my bug
immediately obvious.