[llvm] r222556 - Add params() to FunctionType. NFC.

Rafael Espindola rafael.espindola at gmail.com
Fri Nov 21 11:03:35 PST 2014


Author: rafael
Date: Fri Nov 21 13:03:35 2014
New Revision: 222556

URL: http://llvm.org/viewvc/llvm-project?rev=222556&view=rev
Log:
Add params() to FunctionType. NFC.

While at it, also use makeArrayRef in elements().

Modified:
    llvm/trunk/include/llvm/IR/DerivedTypes.h
    llvm/trunk/lib/IR/LLVMContextImpl.h

Modified: llvm/trunk/include/llvm/IR/DerivedTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DerivedTypes.h?rev=222556&r1=222555&r2=222556&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DerivedTypes.h (original)
+++ llvm/trunk/include/llvm/IR/DerivedTypes.h Fri Nov 21 13:03:35 2014
@@ -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

Modified: llvm/trunk/lib/IR/LLVMContextImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContextImpl.h?rev=222556&r1=222555&r2=222556&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContextImpl.h (original)
+++ llvm/trunk/lib/IR/LLVMContextImpl.h Fri Nov 21 13:03:35 2014
@@ -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;





More information about the llvm-commits mailing list