+ /// Function ctor - If the (optional) Module argument is specified, the
+ /// function is automatically inserted into the end of the function list for
+ /// the module.
+ ///
+ Function(const FunctionType *Ty, LinkageTypes Linkage,
+ const std::string &N = "", Module *M = 0);
+ ~Function();
+
+ const Type *getReturnType() const; // Return the type of the ret val
+ const FunctionType *getFunctionType() const; // Return the FunctionType for me
+
+ /// isVarArg - Return true if this function takes a variable number of
+ /// arguments.
+ bool isVarArg() const;
+
+ /// isDeclaration - Is the body of this function unknown? (The basic block
+ /// list is empty if so.) This is true for function declarations, but not
+ /// true for function definitions.
+ ///
+ virtual bool isDeclaration() const { return BasicBlocks.empty(); }
+
+ /// getIntrinsicID - This method returns the ID number of the specified
+ /// function, or Intrinsic::not_intrinsic if the function is not an
+ /// instrinsic, or if the pointer is null. This value is always defined to be
+ /// zero to allow easy checking for whether a function is intrinsic or not.
+ /// The particular intrinsic functions which correspond to this value are
+ /// defined in llvm/Intrinsics.h.
+ ///
+ unsigned getIntrinsicID(bool noAssert = false) const;
+ bool isIntrinsic() const { return getIntrinsicID() != 0; }
+
+ /// getCallingConv()/setCallingConv(uint) - These method get and set the
+ /// calling convention of this function. The enum values for the known
+ /// calling conventions are defined in CallingConv.h.
+ unsigned getCallingConv() const { return SubclassData >> 1; }
+ void setCallingConv(unsigned CC) {
+ SubclassData = (SubclassData & 1) | (CC << 1);
+ }
+
+ /// Obtains a constant pointer to the ParamAttrsList object which holds the
+ /// parameter attributes information, if any.
+ /// @returns 0 if no parameter attributes have been set.
+ /// @brief Get the parameter attributes.
+ const ParamAttrsList *getParamAttrs() const { return ParamAttrs; }
+
+ /// Sets the parameter attributes for this Function. To construct a
+ /// ParamAttrsList, see ParameterAttributes.h
+ /// @brief Set the parameter attributes.
+ void setParamAttrs(const ParamAttrsList *attrs);
+
+ /// @brief Determine whether the function has the given attribute.
+ bool paramHasAttr(uint16_t i, ParameterAttributes attr) const {
+ return ParamAttrs && ParamAttrs->paramHasAttr(i, attr);
+ }