[PATCH] D32009: Allow attributes with global variables

Jonathan Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 08:17:14 PDT 2017


jroelofs added a subscriber: jmolloy.
jroelofs added a comment.

Sorry I didn't spot these earlier, but...



================
Comment at: include/llvm/IR/Attributes.h:568
+  /// The function attributes are returned.
+  AttributeList getAttributes() const { return Impl; }
+
----------------
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)?


================
Comment at: include/llvm/IR/GlobalVariable.h:204
+  /// Return the attribute list for this global
+  AttributeListType getAttributes() const { return Attrs; }
+
----------------
Should this be return by reference instead of value (avoiding the copy)?


https://reviews.llvm.org/D32009





More information about the llvm-commits mailing list