From: Tim Shen Date: Fri, 19 Aug 2016 21:52:34 +0000 (+0000) Subject: [CallGraph] Use decltype instead of pointer_to_unary_function. NFC. X-Git-Tag: llvmorg-4.0.0-rc1~11865 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7c9cfb5b961ea8cb0a4cc5fdd65c84797e528e94;p=platform%2Fupstream%2Fllvm.git [CallGraph] Use decltype instead of pointer_to_unary_function. NFC. Reviewers: dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D23725 llvm-svn: 279328 --- diff --git a/llvm/include/llvm/Analysis/CallGraph.h b/llvm/include/llvm/Analysis/CallGraph.h index 9ea22a2..54da6e8 100644 --- a/llvm/include/llvm/Analysis/CallGraph.h +++ b/llvm/include/llvm/Analysis/CallGraph.h @@ -413,21 +413,20 @@ template <> struct GraphTraits { typedef CallGraphNode *NodeRef; typedef CallGraphNode::CallRecord CGNPairTy; - typedef std::pointer_to_unary_function - CGNDerefFun; static NodeType *getEntryNode(CallGraphNode *CGN) { return CGN; } - typedef mapped_iterator ChildIteratorType; + static CallGraphNode *CGNGetValue(CGNPairTy P) { return P.second; } + + typedef mapped_iterator + ChildIteratorType; static inline ChildIteratorType child_begin(NodeType *N) { - return map_iterator(N->begin(), CGNDerefFun(CGNDeref)); + return ChildIteratorType(N->begin(), &CGNGetValue); } static inline ChildIteratorType child_end(NodeType *N) { - return map_iterator(N->end(), CGNDerefFun(CGNDeref)); + return ChildIteratorType(N->end(), &CGNGetValue); } - - static CallGraphNode *CGNDeref(CGNPairTy P) { return P.second; } }; template <> struct GraphTraits { @@ -435,22 +434,20 @@ template <> struct GraphTraits { typedef const CallGraphNode *NodeRef; typedef CallGraphNode::CallRecord CGNPairTy; - typedef std::pointer_to_unary_function - CGNDerefFun; static NodeType *getEntryNode(const CallGraphNode *CGN) { return CGN; } - typedef mapped_iterator + static const CallGraphNode *CGNGetValue(CGNPairTy P) { return P.second; } + + typedef mapped_iterator ChildIteratorType; static inline ChildIteratorType child_begin(NodeType *N) { - return map_iterator(N->begin(), CGNDerefFun(CGNDeref)); + return ChildIteratorType(N->begin(), &CGNGetValue); } static inline ChildIteratorType child_end(NodeType *N) { - return map_iterator(N->end(), CGNDerefFun(CGNDeref)); + return ChildIteratorType(N->end(), &CGNGetValue); } - - static const CallGraphNode *CGNDeref(CGNPairTy P) { return P.second; } }; template <> @@ -460,19 +457,19 @@ struct GraphTraits : public GraphTraits { } typedef std::pair> PairTy; - typedef std::pointer_to_unary_function - DerefFun; + static CallGraphNode *CGGetValuePtr(const PairTy &P) { + return P.second.get(); + } // nodes_iterator/begin/end - Allow iteration over all nodes in the graph - typedef mapped_iterator nodes_iterator; + typedef mapped_iterator + nodes_iterator; static nodes_iterator nodes_begin(CallGraph *CG) { - return map_iterator(CG->begin(), DerefFun(CGdereference)); + return nodes_iterator(CG->begin(), &CGGetValuePtr); } static nodes_iterator nodes_end(CallGraph *CG) { - return map_iterator(CG->end(), DerefFun(CGdereference)); + return nodes_iterator(CG->end(), &CGGetValuePtr); } - - static CallGraphNode *CGdereference(const PairTy &P) { return P.second.get(); } }; template <> @@ -483,20 +480,18 @@ struct GraphTraits : public GraphTraits< } typedef std::pair> PairTy; - typedef std::pointer_to_unary_function - DerefFun; + static const CallGraphNode *CGGetValuePtr(const PairTy &P) { + return P.second.get(); + } // nodes_iterator/begin/end - Allow iteration over all nodes in the graph - typedef mapped_iterator nodes_iterator; + typedef mapped_iterator + nodes_iterator; static nodes_iterator nodes_begin(const CallGraph *CG) { - return map_iterator(CG->begin(), DerefFun(CGdereference)); + return nodes_iterator(CG->begin(), &CGGetValuePtr); } static nodes_iterator nodes_end(const CallGraph *CG) { - return map_iterator(CG->end(), DerefFun(CGdereference)); - } - - static const CallGraphNode *CGdereference(const PairTy &P) { - return P.second.get(); + return nodes_iterator(CG->end(), &CGGetValuePtr); } };