forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348372 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
1 changed file
with
64 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters