From: Richard Trieu Date: Thu, 22 May 2014 01:39:16 +0000 (+0000) Subject: Add hasSameType overload to ASTContext for Type pointers. Switch a type X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b1ac4f7de9ec8256bbf5d371addd849fb9596ca1;p=clang Add hasSameType overload to ASTContext for Type pointers. Switch a type comparison check to use this instead of calling Type::getCanonicalTypeInternal git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209378 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 1f97a4c6f0..7ca5da8862 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -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. /// diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 3ea939f4cd..3aca69244d 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -2526,8 +2526,7 @@ void Sema::HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, if (FromType->isMemberPointerType() && ToType->isMemberPointerType()) { const MemberPointerType *FromMember = FromType->getAs(), *ToMember = ToType->getAs(); - 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;