summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-12-27 07:47:40 +0000
committerChris Lattner <sabre@nondot.org>2008-12-27 07:47:40 +0000
commit8ee284673f9581a8e43159e296dbbb3e4832c81a (patch)
treef43fa8e8addfe82f7364cabda4f53c4ba386e197 /llvm
parent8233527b0543795cbccb616c5ce647c26d6bbdca (diff)
downloadbcm5719-llvm-8ee284673f9581a8e43159e296dbbb3e4832c81a.tar.gz
bcm5719-llvm-8ee284673f9581a8e43159e296dbbb3e4832c81a.zip
implement simplify_type for PATypeHolder so that isa<FooType>(PATypeHolder)
works. llvm-svn: 61448
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/AbstractTypeUser.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/include/llvm/AbstractTypeUser.h b/llvm/include/llvm/AbstractTypeUser.h
index f7fabfcb2fe..80656d89b72 100644
--- a/llvm/include/llvm/AbstractTypeUser.h
+++ b/llvm/include/llvm/AbstractTypeUser.h
@@ -33,6 +33,7 @@ namespace llvm {
class Type;
class DerivedType;
+template<typename T> struct simplify_type;
/// The AbstractTypeUser class is an interface to be implemented by classes who
/// could possibly use an abstract type. Abstract types are denoted by the
@@ -174,6 +175,21 @@ private:
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
#endif
OpenPOWER on IntegriCloud