r209378 - Add hasSameType overload to ASTContext for Type pointers. Switch a type

Richard Trieu rtrieu at google.com
Wed May 21 18:39:16 PDT 2014


Author: rtrieu
Date: Wed May 21 20:39:16 2014
New Revision: 209378

URL: http://llvm.org/viewvc/llvm-project?rev=209378&view=rev
Log:
Add hasSameType overload to ASTContext for Type pointers.  Switch a type
comparison check to use this instead of calling Type::getCanonicalTypeInternal

Modified:
    cfe/trunk/include/clang/AST/ASTContext.h
    cfe/trunk/lib/Sema/SemaOverload.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=209378&r1=209377&r2=209378&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Wed May 21 20:39:16 2014
@@ -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.
   ///

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=209378&r1=209377&r2=209378&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed May 21 20:39:16 2014
@@ -2526,8 +2526,7 @@ void Sema::HandleFunctionTypeMismatch(Pa
   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;





More information about the cfe-commits mailing list