forked from OSchip/llvm-project
implement simplify_type for PATypeHolder so that isa<FooType>(PATypeHolder)
works. llvm-svn: 61448
This commit is contained in:
parent
8233527b05
commit
8ee284673f
|
@ -33,6 +33,7 @@ namespace llvm {
|
||||||
|
|
||||||
class Type;
|
class Type;
|
||||||
class DerivedType;
|
class DerivedType;
|
||||||
|
template<typename T> struct simplify_type;
|
||||||
|
|
||||||
/// The AbstractTypeUser class is an interface to be implemented by classes who
|
/// The AbstractTypeUser class is an interface to be implemented by classes who
|
||||||
/// could possibly use an abstract type. Abstract types are denoted by the
|
/// could possibly use an abstract type. Abstract types are denoted by the
|
||||||
|
@ -174,6 +175,21 @@ private:
|
||||||
void dropRef();
|
void dropRef();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// simplify_type - Allow clients to treat uses just like values when using
|
||||||
|
// casting operators.
|
||||||
|
template<> struct simplify_type<PATypeHolder> {
|
||||||
|
typedef const Type* SimpleType;
|
||||||
|
static SimpleType getSimplifiedValue(const PATypeHolder &Val) {
|
||||||
|
return static_cast<SimpleType>(Val.get());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
template<> struct simplify_type<const PATypeHolder> {
|
||||||
|
typedef const Type* SimpleType;
|
||||||
|
static SimpleType getSimplifiedValue(const PATypeHolder &Val) {
|
||||||
|
return static_cast<SimpleType>(Val.get());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue