[cfe-commits] r39258 - /cfe/cfe/trunk/include/clang/AST/Type.h

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:42:04 PDT 2007


Author: sabre
Date: Wed Jul 11 11:42:04 2007
New Revision: 39258

URL: http://llvm.org/viewvc/llvm-project?rev=39258&view=rev
Log:
Implement llvm::simplify_type, allowing dyn_cast<FunctionType>(typeref).

Modified:
    cfe/cfe/trunk/include/clang/AST/Type.h

Modified: cfe/cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Type.h?rev=39258&r1=39257&r2=39258&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Type.h Wed Jul 11 11:42:04 2007
@@ -119,6 +119,20 @@
   void dump() const;
 };
 
+} // end clang.
+
+/// Implement simplify_type for TypeRef, so that we can dyn_cast from TypeRef to
+/// a specific Type class.
+template<> struct simplify_type<const clang::TypeRef> {
+  typedef clang::Type* SimpleType;
+  static SimpleType getSimplifiedValue(const clang::TypeRef &Val) {
+    return Val.getTypePtr();
+  }
+};
+template<> struct simplify_type<clang::TypeRef>
+  : public simplify_type<const clang::TypeRef> {};
+
+namespace clang {
 
 /// Type - This is the base class of the type hierarchy.  A central concept
 /// with types is that each type always has a canonical type.  A canonical type





More information about the cfe-commits mailing list