[PATCH] D32009: Allow attributes with global variables

Jonathan Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 15:03:01 PDT 2017


jroelofs added inline comments.


================
Comment at: include/llvm/IR/Attributes.h:568
+  /// The function attributes are returned.
+  AttributeList getAttributes() const { return Impl; }
+
----------------
javed.absar wrote:
> jroelofs wrote:
> > Usage of this encourages a lot of: `getAttributes().getAttributes()` which seems odd. @jmolloy/@javed.absar did you consider making this an `operator->()`?
> > 
> > Either way, shouldn't this return by reference, and not value (avoiding the copy)?
> The AttributeList is thin (containing pointer to impl), so should not be a problem passing around by value.  Other usages e.g. class Function handles AttributeList  similarly by passing it around by value.
> 
Oh, ok. Cool.


https://reviews.llvm.org/D32009





More information about the llvm-commits mailing list