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

Chris Lattner sabre at nondot.org
Sat Mar 28 17:03:08 PDT 2009


Author: lattner
Date: Sat Mar 28 19:03:08 2009
New Revision: 67967

URL: http://llvm.org/viewvc/llvm-project?rev=67967&view=rev
Log:
implement the PointerLikeTypeInfo trait for QualType, allowing
it to be stuck into a SmallPtrSet.

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

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

==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Sat Mar 28 19:03:08 2009
@@ -27,6 +27,11 @@
 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< ::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 {





More information about the cfe-commits mailing list