From 8ee284673f9581a8e43159e296dbbb3e4832c81a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 27 Dec 2008 07:47:40 +0000 Subject: [PATCH] implement simplify_type for PATypeHolder so that isa(PATypeHolder) works. llvm-svn: 61448 --- llvm/include/llvm/AbstractTypeUser.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/llvm/include/llvm/AbstractTypeUser.h b/llvm/include/llvm/AbstractTypeUser.h index f7fabfcb2fe4..80656d89b726 100644 --- a/llvm/include/llvm/AbstractTypeUser.h +++ b/llvm/include/llvm/AbstractTypeUser.h @@ -33,6 +33,7 @@ namespace llvm { class Type; class DerivedType; +template 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 { + typedef const Type* SimpleType; + static SimpleType getSimplifiedValue(const PATypeHolder &Val) { + return static_cast(Val.get()); + } +}; +template<> struct simplify_type { + typedef const Type* SimpleType; + static SimpleType getSimplifiedValue(const PATypeHolder &Val) { + return static_cast(Val.get()); + } +}; + } // End llvm namespace #endif