From 9098c9f1a82202c9b1b81e8251d5d7feaea0ab27 Mon Sep 17 00:00:00 2001 From: Richard Trieu Date: Thu, 22 May 2014 01:39:16 +0000 Subject: [PATCH] Add hasSameType overload to ASTContext for Type pointers. Switch a type comparison check to use this instead of calling Type::getCanonicalTypeInternal llvm-svn: 209378 --- clang/include/clang/AST/ASTContext.h | 4 ++++ clang/lib/Sema/SemaOverload.cpp | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index 1f97a4c..7ca5da8 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/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/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 3ea939f..3aca692 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/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; -- 2.7.4