[llvm-commits] [llvm] r61448 - /llvm/trunk/include/llvm/AbstractTypeUser.h

Chris Lattner sabre at nondot.org
Fri Dec 26 23:47:41 PST 2008


Author: lattner
Date: Sat Dec 27 01:47:40 2008
New Revision: 61448

URL: http://llvm.org/viewvc/llvm-project?rev=61448&view=rev
Log:
implement simplify_type for PATypeHolder so that isa<FooType>(PATypeHolder)
works.

Modified:
    llvm/trunk/include/llvm/AbstractTypeUser.h

Modified: llvm/trunk/include/llvm/AbstractTypeUser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/AbstractTypeUser.h?rev=61448&r1=61447&r2=61448&view=diff

==============================================================================
--- llvm/trunk/include/llvm/AbstractTypeUser.h (original)
+++ llvm/trunk/include/llvm/AbstractTypeUser.h Sat Dec 27 01:47:40 2008
@@ -33,6 +33,7 @@
 
 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 @@
   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





More information about the llvm-commits mailing list