From 4e7072872e8e2ed76a4c6933424bffa253896e7e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 29 Mar 2009 00:03:08 +0000 Subject: [PATCH] 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 --- include/clang/AST/Type.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 + class PointerLikeTypeInfo; +} + namespace clang { class ASTContext; class Type; @@ -218,6 +223,17 @@ template<> struct simplify_type { template<> struct simplify_type< ::clang::QualType> : public simplify_type {}; +// Teach SmallPtrSet that QualType is "basically a pointer". +template<> +class PointerLikeTypeInfo { +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 { -- 2.40.0