diff options
author | Brian Gesiak <modocache@gmail.com> | 2018-12-05 15:33:55 +0000 |
---|---|---|
committer | Brian Gesiak <modocache@gmail.com> | 2018-12-05 15:33:55 +0000 |
commit | df843bddfbf53b20b995c154546d57b1ada90c20 (patch) | |
tree | ee4b93adb2af352f58ec5d893b936051b91c87f7 /llvm/lib/Target | |
parent | 5b4db77b13525458d970c6bd85d726ba2f48da5a (diff) | |
download | bcm5719-llvm-df843bddfbf53b20b995c154546d57b1ada90c20.tar.gz bcm5719-llvm-df843bddfbf53b20b995c154546d57b1ada90c20.zip |
[IR] Add NODISCARD to attribute functions
Summary:
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.
Reviewers: rnk, javed.absar
Reviewed By: rnk
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D55217
llvm-svn: 348372
Diffstat (limited to 'llvm/lib/Target')
0 files changed, 0 insertions, 0 deletions