mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 23:24:34 +00:00
Pull iterators out of CFG.h and CFGdecls and put them in Support directory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@664 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -27,6 +27,7 @@
|
||||
#define LLVM_TYPE_H
|
||||
|
||||
#include "llvm/Value.h"
|
||||
#include "llvm/Support/GraphTraits.h"
|
||||
|
||||
class DerivedType;
|
||||
class MethodType;
|
||||
@ -264,4 +265,34 @@ inline Type::TypeIterator Type::subtype_end() const {
|
||||
return TypeIterator(this, getNumContainedTypes());
|
||||
}
|
||||
|
||||
|
||||
// Provide specializations of GraphTraits to be able to treat a type as a
|
||||
// graph of sub types...
|
||||
|
||||
template <> struct GraphTraits<Type*> {
|
||||
typedef Type NodeType;
|
||||
typedef Type::subtype_iterator ChildIteratorType;
|
||||
|
||||
static inline NodeType *getEntryNode(Type *T) { return T; }
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return N->subtype_begin();
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return N->subtype_end();
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct GraphTraits<const Type*> {
|
||||
typedef const Type NodeType;
|
||||
typedef Type::subtype_iterator ChildIteratorType;
|
||||
|
||||
static inline NodeType *getEntryNode(const Type *T) { return T; }
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return N->subtype_begin();
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return N->subtype_end();
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user