diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-04-25 18:40:17 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-04-25 18:40:17 +0000 |
commit | 621c92a582546e2fa5ae28cf8b7e14d5a60fab11 (patch) | |
tree | d6f58f5b7deafb2459e8c92cb3093b046dfa02d3 /lib/Sema/SemaOverload.cpp | |
parent | 8d5fcc7e3fc7347b87b6a95b398d5e17faf974e0 (diff) |
Minor tweak to avoid having to dig through canonical types multiple times when checking a qualification conversion
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130136 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 9c9ff6ddea..06c097c620 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -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 |