diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-29 00:03:08 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-29 00:03:08 +0000 |
commit | 4e7072872e8e2ed76a4c6933424bffa253896e7e (patch) | |
tree | df7cde6e57d4854462f22160b750ad65fd38eebd | |
parent | 81c85c421197a602523781a6ef730639c4c6ea51 (diff) |
implement the PointerLikeTypeInfo trait for QualType, allowing
it to be stuck into a SmallPtrSet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67967 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/Type.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index 0b455aed29..7400fe9ed3 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -27,6 +27,11 @@ using llvm::cast_or_null; using llvm::dyn_cast; using llvm::dyn_cast_or_null; +namespace llvm { + template <typename T> + class PointerLikeTypeInfo; +} + namespace clang { class ASTContext; class Type; @@ -218,6 +223,17 @@ template<> struct simplify_type<const ::clang::QualType> { template<> struct simplify_type< ::clang::QualType> : public simplify_type<const ::clang::QualType> {}; +// Teach SmallPtrSet that QualType is "basically a pointer". +template<> +class PointerLikeTypeInfo<clang::QualType> { +public: + static inline void *getAsVoidPointer(clang::QualType P) { + return P.getAsOpaquePtr(); + } + static inline clang::QualType getFromVoidPointer(void *P) { + return clang::QualType::getFromOpaquePtr(P); + } +}; } // end namespace llvm namespace clang { |