r279475 - [GraphTraits] Replace all NodeType usage with NodeRef
Tim Shen via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 22 14:09:31 PDT 2016
Author: timshen
Date: Mon Aug 22 16:09:30 2016
New Revision: 279475
URL: http://llvm.org/viewvc/llvm-project?rev=279475&view=rev
Log:
[GraphTraits] Replace all NodeType usage with NodeRef
This should finish the GraphTraits migration.
Differential Revision: http://reviews.llvm.org/D23730
Modified:
cfe/trunk/include/clang/AST/StmtGraphTraits.h
cfe/trunk/include/clang/Analysis/Analyses/Dominators.h
cfe/trunk/include/clang/Analysis/CFG.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
cfe/trunk/lib/Serialization/ModuleManager.cpp
Modified: cfe/trunk/include/clang/AST/StmtGraphTraits.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtGraphTraits.h?rev=279475&r1=279474&r2=279475&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/StmtGraphTraits.h (original)
+++ cfe/trunk/include/clang/AST/StmtGraphTraits.h Mon Aug 22 16:09:30 2016
@@ -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::St
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();
}
Modified: cfe/trunk/include/clang/Analysis/Analyses/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Analyses/Dominators.h?rev=279475&r1=279474&r2=279475&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/Analyses/Dominators.h (original)
+++ cfe/trunk/include/clang/Analysis/Analyses/Dominators.h Mon Aug 22 16:09:30 2016
@@ -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:
template <> struct GraphTraits< ::clang::DominatorTree* >
: public GraphTraits< ::clang::DomTreeNode* > {
- static NodeType *getEntryNode(::clang::DominatorTree *DT) {
+ static NodeRef getEntryNode(::clang::DominatorTree *DT) {
return DT->getRootNode();
}
Modified: cfe/trunk/include/clang/Analysis/CFG.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CFG.h?rev=279475&r1=279474&r2=279475&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/CFG.h (original)
+++ cfe/trunk/include/clang/Analysis/CFG.h Mon Aug 22 16:09:30 2016
@@ -945,63 +945,59 @@ template <> struct simplify_type< ::clan
// 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:
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 ::c
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<
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<c
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();
}
Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h?rev=279475&r1=279474&r2=279475&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h Mon Aug 22 16:09:30 2016
@@ -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
Modified: cfe/trunk/lib/Serialization/ModuleManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ModuleManager.cpp?rev=279475&r1=279474&r2=279475&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ModuleManager.cpp (original)
+++ cfe/trunk/lib/Serialization/ModuleManager.cpp Mon Aug 22 16:09:30 2016
@@ -433,16 +433,15 @@ bool ModuleManager::lookupModuleFile(Str
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();
}
More information about the cfe-commits
mailing list