]> granicus.if.org Git - clang/commitdiff
Minor tweak to avoid having to dig through canonical types multiple times when checki...
authorDouglas Gregor <dgregor@apple.com>
Mon, 25 Apr 2011 18:40:17 +0000 (18:40 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 25 Apr 2011 18:40:17 +0000 (18:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130136 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp

index 9c9ff6ddea05b63319a0448cea8534ea3aefc935..06c097c620c636d748051dc1aaa153c1ce9d6edf 100644 (file)
@@ -2171,21 +2171,24 @@ Sema::IsQualificationConversion(QualType FromType, QualType ToType,
     // unwrap.
     UnwrappedAnyPointer = true;
 
+    Qualifiers FromQuals = FromType.getQualifiers();
+    Qualifiers ToQuals = ToType.getQualifiers();
+    
     //   -- for every j > 0, if const is in cv 1,j then const is in cv
     //      2,j, and similarly for volatile.
-    if (!CStyle && !ToType.isAtLeastAsQualifiedAs(FromType))
+    if (!CStyle && !ToQuals.compatiblyIncludes(FromQuals))
       return false;
 
     //   -- if the cv 1,j and cv 2,j are different, then const is in
     //      every cv for 0 < k < j.
-    if (!CStyle && FromType.getCVRQualifiers() != ToType.getCVRQualifiers()
+    if (!CStyle && FromQuals.getCVRQualifiers() != ToQuals.getCVRQualifiers()
         && !PreviousToQualsIncludeConst)
       return false;
 
     // Keep track of whether all prior cv-qualifiers in the "to" type
     // include const.
     PreviousToQualsIncludeConst
-      = PreviousToQualsIncludeConst && ToType.isConstQualified();
+      = PreviousToQualsIncludeConst && ToQuals.hasConst();
   }
 
   // We are left with FromType and ToType being the pointee types