X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FIR%2FFunction.h;h=22444bd3000ef118e0db20bef84f0f4fb7b7f679;hb=b4840d7a4d357b3f79071cccdeaadefe278b912a;hp=11208bb91740f6c9a7a1c86d8ef659d100e1705f;hpb=98f54c09d086f76fa0ec81fc2c01d45bfe5a3739;p=oota-llvm.git diff --git a/include/llvm/IR/Function.h b/include/llvm/IR/Function.h index 11208bb9174..22444bd3000 100644 --- a/include/llvm/IR/Function.h +++ b/include/llvm/IR/Function.h @@ -18,11 +18,12 @@ #ifndef LLVM_IR_FUNCTION_H #define LLVM_IR_FUNCTION_H +#include "llvm/ADT/iterator_range.h" #include "llvm/IR/Argument.h" #include "llvm/IR/Attributes.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/CallingConv.h" -#include "llvm/IR/GlobalValue.h" +#include "llvm/IR/GlobalObject.h" #include "llvm/Support/Compiler.h" namespace llvm { @@ -67,8 +68,7 @@ private: mutable ilist_half_node Sentinel; }; -class Function : public GlobalValue, - public ilist_node { +class Function : public GlobalObject, public ilist_node { public: typedef iplist ArgumentListType; typedef iplist BasicBlockListType; @@ -122,11 +122,11 @@ private: /// the module. /// Function(FunctionType *Ty, LinkageTypes Linkage, - const Twine &N = "", Module *M = 0); + const Twine &N = "", Module *M = nullptr); public: static Function *Create(FunctionType *Ty, LinkageTypes Linkage, - const Twine &N = "", Module *M = 0) { + const Twine &N = "", Module *M = nullptr) { return new(0) Function(Ty, Linkage, N, M); } @@ -297,7 +297,8 @@ public: /// @brief Determine if the function returns a structure through first /// pointer argument. bool hasStructRetAttr() const { - return AttributeSets.hasAttribute(1, Attribute::StructRet); + return AttributeSets.hasAttribute(1, Attribute::StructRet) || + AttributeSets.hasAttribute(2, Attribute::StructRet); } /// @brief Determine if the parameter does not alias other parameters. @@ -404,9 +405,9 @@ public: const BasicBlock &back() const { return BasicBlocks.back(); } BasicBlock &back() { return BasicBlocks.back(); } - //===--------------------------------------------------------------------===// - // Argument iterator forwarding functions - // +/// @name Function Argument Iteration +/// @{ + arg_iterator arg_begin() { CheckLazyArguments(); return ArgumentList.begin(); @@ -424,6 +425,16 @@ public: return ArgumentList.end(); } + iterator_range args() { + return iterator_range(arg_begin(), arg_end()); + } + + iterator_range args() const { + return iterator_range(arg_begin(), arg_end()); + } + +/// @} + size_t arg_size() const; bool arg_empty() const; @@ -472,7 +483,7 @@ public: /// other than direct calls or invokes to it, or blockaddress expressions. /// Optionally passes back an offending user for diagnostic purposes. /// - bool hasAddressTaken(const User** = 0) const; + bool hasAddressTaken(const User** = nullptr) const; /// isDefTriviallyDead - Return true if it is trivially safe to remove /// this function definition from the module (because it isn't externally @@ -494,12 +505,12 @@ private: inline ValueSymbolTable * ilist_traits::getSymTab(Function *F) { - return F ? &F->getValueSymbolTable() : 0; + return F ? &F->getValueSymbolTable() : nullptr; } inline ValueSymbolTable * ilist_traits::getSymTab(Function *F) { - return F ? &F->getValueSymbolTable() : 0; + return F ? &F->getValueSymbolTable() : nullptr; } } // End llvm namespace