summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-11-21 19:03:35 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-11-21 19:03:35 +0000
commite973fd4a09ec971b8fe13b05d039b3b6e1a69ad1 (patch)
tree809450b6542b7f702c15c7e4fc995b5a6ed5e7af
parenteb4a4d5aebfe427f0e09c35641282f755cbef44c (diff)
downloadbcm5719-llvm-e973fd4a09ec971b8fe13b05d039b3b6e1a69ad1.tar.gz
bcm5719-llvm-e973fd4a09ec971b8fe13b05d039b3b6e1a69ad1.zip
Add params() to FunctionType. NFC.
While at it, also use makeArrayRef in elements(). llvm-svn: 222556
-rw-r--r--llvm/include/llvm/IR/DerivedTypes.h6
-rw-r--r--llvm/lib/IR/LLVMContextImpl.h7
2 files changed, 7 insertions, 6 deletions
diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h
index 175d45afdfc..182015c98aa 100644
--- a/llvm/include/llvm/IR/DerivedTypes.h
+++ b/llvm/include/llvm/IR/DerivedTypes.h
@@ -123,6 +123,9 @@ public:
typedef Type::subtype_iterator param_iterator;
param_iterator param_begin() const { return ContainedTys + 1; }
param_iterator param_end() const { return &ContainedTys[NumContainedTys]; }
+ ArrayRef<Type *> params() const {
+ return makeArrayRef(param_begin(), param_end());
+ }
/// Parameter type accessors.
Type *getParamType(unsigned i) const { return ContainedTys[i+1]; }
@@ -274,9 +277,8 @@ public:
typedef Type::subtype_iterator element_iterator;
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());
+ return makeArrayRef(element_begin(), element_end());
}
/// isLayoutIdentical - Return true if this is layout identical to the
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index f018dc73750..7a298cfecf3 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -148,10 +148,9 @@ struct FunctionTypeKeyInfo {
bool isVarArg;
KeyTy(const Type* R, const ArrayRef<Type*>& P, bool V) :
ReturnType(R), Params(P), isVarArg(V) {}
- KeyTy(const FunctionType* FT) :
- ReturnType(FT->getReturnType()),
- Params(makeArrayRef(FT->param_begin(), FT->param_end())),
- isVarArg(FT->isVarArg()) {}
+ KeyTy(const FunctionType *FT)
+ : ReturnType(FT->getReturnType()), Params(FT->params()),
+ isVarArg(FT->isVarArg()) {}
bool operator==(const KeyTy& that) const {
if (ReturnType != that.ReturnType)
return false;
OpenPOWER on IntegriCloud