diff options
author | Tim Shen <timshen91@gmail.com> | 2016-08-22 21:09:30 +0000 |
---|---|---|
committer | Tim Shen <timshen91@gmail.com> | 2016-08-22 21:09:30 +0000 |
commit | f2187ed3210377902124b326957f8721bb58733a (patch) | |
tree | 4505affdaf0d52c11907f4132beb6b21aae6a92c /clang | |
parent | b29ec1e040fb798418eee8a14e13f9df7c372658 (diff) | |
download | bcm5719-llvm-f2187ed3210377902124b326957f8721bb58733a.tar.gz bcm5719-llvm-f2187ed3210377902124b326957f8721bb58733a.zip |
[GraphTraits] Replace all NodeType usage with NodeRef
This should finish the GraphTraits migration.
Differential Revision: http://reviews.llvm.org/D23730
llvm-svn: 279475
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/AST/StmtGraphTraits.h | 14 | ||||
-rw-r--r-- | clang/include/clang/Analysis/Analyses/Dominators.h | 17 | ||||
-rw-r--r-- | clang/include/clang/Analysis/CFG.h | 62 | ||||
-rw-r--r-- | clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h | 42 | ||||
-rw-r--r-- | clang/lib/Serialization/ModuleManager.cpp | 7 |
5 files changed, 56 insertions, 86 deletions
diff --git a/clang/include/clang/AST/StmtGraphTraits.h b/clang/include/clang/AST/StmtGraphTraits.h index dac4495c6a0..11084be40c8 100644 --- a/clang/include/clang/AST/StmtGraphTraits.h +++ b/clang/include/clang/AST/StmtGraphTraits.h @@ -25,19 +25,18 @@ namespace llvm { template <> struct GraphTraits<clang::Stmt*> { - typedef clang::Stmt NodeType; typedef clang::Stmt * NodeRef; typedef clang::Stmt::child_iterator ChildIteratorType; typedef llvm::df_iterator<clang::Stmt*> nodes_iterator; - static NodeType* getEntryNode(clang::Stmt* S) { return S; } + static NodeRef getEntryNode(clang::Stmt *S) { return S; } - static inline ChildIteratorType child_begin(NodeType* N) { + static inline ChildIteratorType child_begin(NodeRef N) { if (N) return N->child_begin(); else return ChildIteratorType(); } - static inline ChildIteratorType child_end(NodeType* N) { + static inline ChildIteratorType child_end(NodeRef N) { if (N) return N->child_end(); else return ChildIteratorType(); } @@ -53,19 +52,18 @@ template <> struct GraphTraits<clang::Stmt*> { template <> struct GraphTraits<const clang::Stmt*> { - typedef const clang::Stmt NodeType; typedef const clang::Stmt * NodeRef; typedef clang::Stmt::const_child_iterator ChildIteratorType; typedef llvm::df_iterator<const clang::Stmt*> nodes_iterator; - static NodeType* getEntryNode(const clang::Stmt* S) { return S; } + static NodeRef getEntryNode(const clang::Stmt *S) { return S; } - static inline ChildIteratorType child_begin(NodeType* N) { + static inline ChildIteratorType child_begin(NodeRef N) { if (N) return N->child_begin(); else return ChildIteratorType(); } - static inline ChildIteratorType child_end(NodeType* N) { + static inline ChildIteratorType child_end(NodeRef N) { if (N) return N->child_end(); else return ChildIteratorType(); } diff --git a/clang/include/clang/Analysis/Analyses/Dominators.h b/clang/include/clang/Analysis/Analyses/Dominators.h index df6118dc2e7..3e625d2102e 100644 --- a/clang/include/clang/Analysis/Analyses/Dominators.h +++ b/clang/include/clang/Analysis/Analyses/Dominators.h @@ -167,19 +167,12 @@ private: /// namespace llvm { template <> struct GraphTraits< ::clang::DomTreeNode* > { - typedef ::clang::DomTreeNode NodeType; typedef ::clang::DomTreeNode *NodeRef; - typedef NodeType::iterator ChildIteratorType; + typedef ::clang::DomTreeNode::iterator ChildIteratorType; - static NodeType *getEntryNode(NodeType *N) { - return N; - } - static inline ChildIteratorType child_begin(NodeType *N) { - return N->begin(); - } - static inline ChildIteratorType child_end(NodeType *N) { - return N->end(); - } + static NodeRef getEntryNode(NodeRef N) { return N; } + static inline ChildIteratorType child_begin(NodeRef N) { return N->begin(); } + static inline ChildIteratorType child_end(NodeRef N) { return N->end(); } typedef llvm::pointer_iterator<df_iterator<::clang::DomTreeNode *>> nodes_iterator; @@ -195,7 +188,7 @@ template <> struct GraphTraits< ::clang::DomTreeNode* > { template <> struct GraphTraits< ::clang::DominatorTree* > : public GraphTraits< ::clang::DomTreeNode* > { - static NodeType *getEntryNode(::clang::DominatorTree *DT) { + static NodeRef getEntryNode(::clang::DominatorTree *DT) { return DT->getRootNode(); } diff --git a/clang/include/clang/Analysis/CFG.h b/clang/include/clang/Analysis/CFG.h index 29d20089f4f..36201b052f5 100644 --- a/clang/include/clang/Analysis/CFG.h +++ b/clang/include/clang/Analysis/CFG.h @@ -945,63 +945,59 @@ template <> struct simplify_type< ::clang::CFGTerminator> { // Traits for: CFGBlock template <> struct GraphTraits< ::clang::CFGBlock *> { - typedef ::clang::CFGBlock NodeType; typedef ::clang::CFGBlock *NodeRef; typedef ::clang::CFGBlock::succ_iterator ChildIteratorType; - static NodeType* getEntryNode(::clang::CFGBlock *BB) - { return BB; } + static NodeRef getEntryNode(::clang::CFGBlock *BB) { return BB; } - static inline ChildIteratorType child_begin(NodeType* N) - { return N->succ_begin(); } + static inline ChildIteratorType child_begin(NodeRef N) { + return N->succ_begin(); + } - static inline ChildIteratorType child_end(NodeType* N) - { return N->succ_end(); } + static inline ChildIteratorType child_end(NodeRef N) { return N->succ_end(); } }; template <> struct GraphTraits< const ::clang::CFGBlock *> { - typedef const ::clang::CFGBlock NodeType; typedef const ::clang::CFGBlock *NodeRef; typedef ::clang::CFGBlock::const_succ_iterator ChildIteratorType; - static NodeType* getEntryNode(const clang::CFGBlock *BB) - { return BB; } + static NodeRef getEntryNode(const clang::CFGBlock *BB) { return BB; } - static inline ChildIteratorType child_begin(NodeType* N) - { return N->succ_begin(); } + static inline ChildIteratorType child_begin(NodeRef N) { + return N->succ_begin(); + } - static inline ChildIteratorType child_end(NodeType* N) - { return N->succ_end(); } + static inline ChildIteratorType child_end(NodeRef N) { return N->succ_end(); } }; template <> struct GraphTraits<Inverse< ::clang::CFGBlock*> > { - typedef ::clang::CFGBlock NodeType; typedef ::clang::CFGBlock *NodeRef; typedef ::clang::CFGBlock::const_pred_iterator ChildIteratorType; - static NodeType *getEntryNode(Inverse< ::clang::CFGBlock*> G) - { return G.Graph; } + static NodeRef getEntryNode(Inverse<::clang::CFGBlock *> G) { + return G.Graph; + } - static inline ChildIteratorType child_begin(NodeType* N) - { return N->pred_begin(); } + static inline ChildIteratorType child_begin(NodeRef N) { + return N->pred_begin(); + } - static inline ChildIteratorType child_end(NodeType* N) - { return N->pred_end(); } + static inline ChildIteratorType child_end(NodeRef N) { return N->pred_end(); } }; template <> struct GraphTraits<Inverse<const ::clang::CFGBlock*> > { - typedef const ::clang::CFGBlock NodeType; typedef const ::clang::CFGBlock *NodeRef; typedef ::clang::CFGBlock::const_pred_iterator ChildIteratorType; - static NodeType *getEntryNode(Inverse<const ::clang::CFGBlock*> G) - { return G.Graph; } + static NodeRef getEntryNode(Inverse<const ::clang::CFGBlock *> G) { + return G.Graph; + } - static inline ChildIteratorType child_begin(NodeType* N) - { return N->pred_begin(); } + static inline ChildIteratorType child_begin(NodeRef N) { + return N->pred_begin(); + } - static inline ChildIteratorType child_end(NodeType* N) - { return N->pred_end(); } + static inline ChildIteratorType child_end(NodeRef N) { return N->pred_end(); } }; // Traits for: CFG @@ -1011,7 +1007,7 @@ template <> struct GraphTraits< ::clang::CFG* > typedef ::clang::CFG::iterator nodes_iterator; - static NodeType *getEntryNode(::clang::CFG* F) { return &F->getEntry(); } + static NodeRef getEntryNode(::clang::CFG *F) { return &F->getEntry(); } static nodes_iterator nodes_begin(::clang::CFG* F) { return F->nodes_begin();} static nodes_iterator nodes_end(::clang::CFG* F) { return F->nodes_end(); } static unsigned size(::clang::CFG* F) { return F->size(); } @@ -1022,9 +1018,7 @@ template <> struct GraphTraits<const ::clang::CFG* > typedef ::clang::CFG::const_iterator nodes_iterator; - static NodeType *getEntryNode( const ::clang::CFG* F) { - return &F->getEntry(); - } + static NodeRef getEntryNode(const ::clang::CFG *F) { return &F->getEntry(); } static nodes_iterator nodes_begin( const ::clang::CFG* F) { return F->nodes_begin(); } @@ -1041,7 +1035,7 @@ template <> struct GraphTraits<Inverse< ::clang::CFG*> > typedef ::clang::CFG::iterator nodes_iterator; - static NodeType *getEntryNode( ::clang::CFG* F) { return &F->getExit(); } + static NodeRef getEntryNode(::clang::CFG *F) { return &F->getExit(); } static nodes_iterator nodes_begin( ::clang::CFG* F) {return F->nodes_begin();} static nodes_iterator nodes_end( ::clang::CFG* F) { return F->nodes_end(); } }; @@ -1051,7 +1045,7 @@ template <> struct GraphTraits<Inverse<const ::clang::CFG*> > typedef ::clang::CFG::const_iterator nodes_iterator; - static NodeType *getEntryNode(const ::clang::CFG* F) { return &F->getExit(); } + static NodeRef getEntryNode(const ::clang::CFG *F) { return &F->getExit(); } static nodes_iterator nodes_begin(const ::clang::CFG* F) { return F->nodes_begin(); } diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h index 03a0f116d54..48feef413e3 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h @@ -450,57 +450,43 @@ public: namespace llvm { template<> struct GraphTraits<clang::ento::ExplodedNode*> { - typedef clang::ento::ExplodedNode NodeType; typedef clang::ento::ExplodedNode *NodeRef; - typedef NodeType::succ_iterator ChildIteratorType; - typedef llvm::df_iterator<NodeType*> nodes_iterator; + typedef clang::ento::ExplodedNode::succ_iterator ChildIteratorType; + typedef llvm::df_iterator<NodeRef> nodes_iterator; - static inline NodeType* getEntryNode(NodeType* N) { - return N; - } + static inline NodeRef getEntryNode(NodeRef N) { return N; } - static inline ChildIteratorType child_begin(NodeType* N) { + static inline ChildIteratorType child_begin(NodeRef N) { return N->succ_begin(); } - static inline ChildIteratorType child_end(NodeType* N) { + static inline ChildIteratorType child_end(NodeRef N) { return N->succ_end(); } - static inline nodes_iterator nodes_begin(NodeType* N) { - return df_begin(N); - } + static inline nodes_iterator nodes_begin(NodeRef N) { return df_begin(N); } - static inline nodes_iterator nodes_end(NodeType* N) { - return df_end(N); - } + static inline nodes_iterator nodes_end(NodeRef N) { return df_end(N); } }; template<> struct GraphTraits<const clang::ento::ExplodedNode*> { - typedef const clang::ento::ExplodedNode NodeType; typedef const clang::ento::ExplodedNode *NodeRef; - typedef NodeType::const_succ_iterator ChildIteratorType; - typedef llvm::df_iterator<NodeType*> nodes_iterator; + typedef clang::ento::ExplodedNode::const_succ_iterator ChildIteratorType; + typedef llvm::df_iterator<NodeRef> nodes_iterator; - static inline NodeType* getEntryNode(NodeType* N) { - return N; - } + static inline NodeRef getEntryNode(NodeRef N) { return N; } - static inline ChildIteratorType child_begin(NodeType* N) { + static inline ChildIteratorType child_begin(NodeRef N) { return N->succ_begin(); } - static inline ChildIteratorType child_end(NodeType* N) { + static inline ChildIteratorType child_end(NodeRef N) { return N->succ_end(); } - static inline nodes_iterator nodes_begin(NodeType* N) { - return df_begin(N); - } + static inline nodes_iterator nodes_begin(NodeRef N) { return df_begin(N); } - static inline nodes_iterator nodes_end(NodeType* N) { - return df_end(N); - } + static inline nodes_iterator nodes_end(NodeRef N) { return df_end(N); } }; } // end llvm namespace diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index bc57d8cbc7a..f6452480882 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/lib/Serialization/ModuleManager.cpp @@ -433,16 +433,15 @@ bool ModuleManager::lookupModuleFile(StringRef FileName, namespace llvm { template<> struct GraphTraits<ModuleManager> { - typedef ModuleFile NodeType; typedef ModuleFile *NodeRef; typedef llvm::SetVector<ModuleFile *>::const_iterator ChildIteratorType; typedef ModuleManager::ModuleConstIterator nodes_iterator; - - static ChildIteratorType child_begin(NodeType *Node) { + + static ChildIteratorType child_begin(NodeRef Node) { return Node->Imports.begin(); } - static ChildIteratorType child_end(NodeType *Node) { + static ChildIteratorType child_end(NodeRef Node) { return Node->Imports.end(); } |