diff options
author | Chris Lattner <sabre@nondot.org> | 2008-12-27 07:47:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-12-27 07:47:40 +0000 |
commit | 793b2e3f6f3975cfa11692af058931b4a0988955 (patch) | |
tree | c83566aef25dba63d2d6d092af45bb6d3b14ae64 /include | |
parent | f0569be4a948c7ed816bfa2b8774a5a18458ee23 (diff) | |
download | external_llvm-793b2e3f6f3975cfa11692af058931b4a0988955.zip external_llvm-793b2e3f6f3975cfa11692af058931b4a0988955.tar.gz external_llvm-793b2e3f6f3975cfa11692af058931b4a0988955.tar.bz2 |
implement simplify_type for PATypeHolder so that isa<FooType>(PATypeHolder)
works.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61448 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/AbstractTypeUser.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/llvm/AbstractTypeUser.h b/include/llvm/AbstractTypeUser.h index f7fabfc..80656d8 100644 --- a/include/llvm/AbstractTypeUser.h +++ b/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 |