Add and use a helper elements() to StructType. NFC.
[oota-llvm.git] / include / llvm / IR / DerivedTypes.h
index 534d1e54160c60ff3212b1e3c16815264312bad3..175d45afdfcefac0075ee7ff01986ab9b9ab56cf 100644 (file)
@@ -275,6 +275,10 @@ public:
   element_iterator element_begin() const { return ContainedTys; }
   element_iterator element_end() const { return &ContainedTys[NumContainedTys];}
 
   element_iterator element_begin() const { return ContainedTys; }
   element_iterator element_end() const { return &ContainedTys[NumContainedTys];}
 
+  ArrayRef<Type *> const elements() const {
+    return ArrayRef<Type*>(&*element_begin(), getNumElements());
+  }
+
   /// isLayoutIdentical - Return true if this is layout identical to the
   /// specified struct.
   bool isLayoutIdentical(StructType *Other) const;  
   /// isLayoutIdentical - Return true if this is layout identical to the
   /// specified struct.
   bool isLayoutIdentical(StructType *Other) const;