summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-11-21 18:53:05 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-11-21 18:53:05 +0000
commit334b73f4705ab354dc3d20389d2b8c727457e9f1 (patch)
tree611cacedd36d07f97f6a42696ee344ad5dd251c8
parentef3e42b8b56b0e3211e7619ad306f237f0e0e26e (diff)
downloadbcm5719-llvm-334b73f4705ab354dc3d20389d2b8c727457e9f1.tar.gz
bcm5719-llvm-334b73f4705ab354dc3d20389d2b8c727457e9f1.zip
Add and use a helper elements() to StructType. NFC.
llvm-svn: 222553
-rw-r--r--llvm/include/llvm/IR/DerivedTypes.h4
-rw-r--r--llvm/lib/IR/LLVMContextImpl.h5
2 files changed, 6 insertions, 3 deletions
diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h
index 534d1e54160..175d45afdfc 100644
--- a/llvm/include/llvm/IR/DerivedTypes.h
+++ b/llvm/include/llvm/IR/DerivedTypes.h
@@ -275,6 +275,10 @@ public:
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;
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index e743ec3abc4..f018dc73750 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -104,9 +104,8 @@ struct AnonStructTypeKeyInfo {
bool isPacked;
KeyTy(const ArrayRef<Type*>& E, bool P) :
ETypes(E), isPacked(P) {}
- KeyTy(const StructType* ST) :
- ETypes(ArrayRef<Type*>(ST->element_begin(), ST->element_end())),
- isPacked(ST->isPacked()) {}
+ KeyTy(const StructType *ST)
+ : ETypes(ST->elements()), isPacked(ST->isPacked()) {}
bool operator==(const KeyTy& that) const {
if (isPacked != that.isPacked)
return false;
OpenPOWER on IntegriCloud