+ /// FunctionType::get - This static method is the primary way of constructing
+ /// a FunctionType.
+ ///
+ static FunctionType *get(
+ const Type *Result, ///< The result type
+ const std::vector<const Type*> &Params, ///< The types of the parameters
+ bool isVarArg, ///< Whether this is a variable argument length function
+ ParamAttrsList *Attrs = 0
+ ///< Indicates the parameter attributes to use, if any. The 0th entry
+ ///< in the list refers to the return type. Parameters are numbered
+ ///< starting at 1. This argument must be on the heap and FunctionType
+ ///< owns it after its passed here.
+ );
+
+ inline bool isVarArg() const { return isVarArgs; }
+ inline const Type *getReturnType() const { return ContainedTys[0]; }
+
+ typedef Type::subtype_iterator param_iterator;
+ param_iterator param_begin() const { return ContainedTys + 1; }
+ param_iterator param_end() const { return &ContainedTys[NumContainedTys]; }
+
+ // Parameter type accessors...
+ const Type *getParamType(unsigned i) const { return ContainedTys[i+1]; }
+
+ /// getNumParams - Return the number of fixed parameters this function type
+ /// requires. This does not consider varargs.
+ ///
+ unsigned getNumParams() const { return NumContainedTys - 1; }
+
+ bool isStructReturn() const;
+
+ /// The parameter attributes for the \p ith parameter are returned. The 0th
+ /// parameter refers to the return type of the function.
+ /// @returns The ParameterAttributes for the \p ith parameter.
+ /// @brief Get the attributes for a parameter
+ const ParamAttrsList *getParamAttrs() const { return ParamAttrs; }
+
+ // Implement the AbstractTypeUser interface.
+ virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy);
+ virtual void typeBecameConcrete(const DerivedType *AbsTy);
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const FunctionType *T) { return true; }
+ static inline bool classof(const Type *T) {
+ return T->getTypeID() == FunctionTyID;
+ }
+};