Add hasSameType overload to ASTContext for Type pointers. Switch a type
authorRichard Trieu <rtrieu@google.com>
Thu, 22 May 2014 01:39:16 +0000 (01:39 +0000)
committerRichard Trieu <rtrieu@google.com>
Thu, 22 May 2014 01:39:16 +0000 (01:39 +0000)
comparison check to use this instead of calling Type::getCanonicalTypeInternal

llvm-svn: 209378

clang/include/clang/AST/ASTContext.h
clang/lib/Sema/SemaOverload.cpp

index 1f97a4c..7ca5da8 100644 (file)
@@ -1778,6 +1778,10 @@ public:
     return getCanonicalType(T1) == getCanonicalType(T2);
   }
 
+  bool hasSameType(const Type *T1, const Type *T2) const {
+    return getCanonicalType(T1) == getCanonicalType(T2);
+  }
+
   /// \brief Return this type as a completely-unqualified array type,
   /// capturing the qualifiers in \p Quals.
   ///
index 3ea939f..3aca692 100644 (file)
@@ -2526,8 +2526,7 @@ void Sema::HandleFunctionTypeMismatch(PartialDiagnostic &PDiag,
   if (FromType->isMemberPointerType() && ToType->isMemberPointerType()) {
     const MemberPointerType *FromMember = FromType->getAs<MemberPointerType>(),
                             *ToMember = ToType->getAs<MemberPointerType>();
-    if (FromMember->getClass()->getCanonicalTypeInternal() !=
-        ToMember->getClass()->getCanonicalTypeInternal()) {
+    if (!Context.hasSameType(FromMember->getClass(), ToMember->getClass())) {
       PDiag << ft_different_class << QualType(ToMember->getClass(), 0)
             << QualType(FromMember->getClass(), 0);
       return;