r284895 - Remove unnecessary distinction between Ref_Compatible and
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 21 16:01:56 PDT 2016
Author: rsmith
Date: Fri Oct 21 18:01:55 2016
New Revision: 284895
URL: http://llvm.org/viewvc/llvm-project?rev=284895&view=rev
Log:
Remove unnecessary distinction between Ref_Compatible and
Ref_Compatible_With_Added_Qualification. We always treated these two values the
same way.
Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaCast.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=284895&r1=284894&r2=284895&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Oct 21 18:01:55 2016
@@ -8992,13 +8992,7 @@ public:
/// that their unqualified forms (T1 and T2) are either the same
/// or T1 is a base class of T2.
Ref_Related,
- /// Ref_Compatible_With_Added_Qualification - The two types are
- /// reference-compatible with added qualification, meaning that
- /// they are reference-compatible and the qualifiers on T1 (cv1)
- /// are greater than the qualifiers on T2 (cv2).
- Ref_Compatible_With_Added_Qualification,
- /// Ref_Compatible - The two types are reference-compatible and
- /// have equivalent qualifiers (cv1 == cv2).
+ /// Ref_Compatible - The two types are reference-compatible.
Ref_Compatible
};
Modified: cfe/trunk/lib/Sema/SemaCast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCast.cpp?rev=284895&r1=284894&r2=284895&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCast.cpp Fri Oct 21 18:01:55 2016
@@ -1165,7 +1165,7 @@ TryLValueToRValueCast(Sema &Self, Expr *
ToType, FromType,
DerivedToBase, ObjCConversion,
ObjCLifetimeConversion)
- < Sema::Ref_Compatible_With_Added_Qualification) {
+ != Sema::Ref_Compatible) {
if (CStyle)
return TC_NotApplicable;
msg = diag::err_bad_lvalue_to_rvalue_cast;
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=284895&r1=284894&r2=284895&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Fri Oct 21 18:01:55 2016
@@ -4263,7 +4263,7 @@ static void TryReferenceInitializationCo
bool T1Function = T1->isFunctionType();
if (isLValueRef || T1Function) {
if (InitCategory.isLValue() &&
- (RefRelationship >= Sema::Ref_Compatible_With_Added_Qualification ||
+ (RefRelationship == Sema::Ref_Compatible ||
(Kind.isCStyleOrFunctionalCast() &&
RefRelationship == Sema::Ref_Related))) {
// - is an lvalue (but is not a bit-field), and "cv1 T1" is
@@ -4336,7 +4336,7 @@ static void TryReferenceInitializationCo
// "cv1 T1" is reference-compatible with "cv2 T2"
// Note: functions are handled below.
if (!T1Function &&
- (RefRelationship >= Sema::Ref_Compatible_With_Added_Qualification ||
+ (RefRelationship == Sema::Ref_Compatible ||
(Kind.isCStyleOrFunctionalCast() &&
RefRelationship == Sema::Ref_Related)) &&
(InitCategory.isXValue() ||
@@ -4393,8 +4393,7 @@ static void TryReferenceInitializationCo
return;
}
- if ((RefRelationship == Sema::Ref_Compatible ||
- RefRelationship == Sema::Ref_Compatible_With_Added_Qualification) &&
+ if (RefRelationship == Sema::Ref_Compatible &&
isRValueRef && InitCategory.isLValue()) {
Sequence.SetFailed(
InitializationSequence::FK_RValueReferenceBindingToLValue);
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=284895&r1=284894&r2=284895&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Oct 21 18:01:55 2016
@@ -4220,10 +4220,8 @@ Sema::CompareReferenceRelationship(Sourc
T1Quals.removeUnaligned();
T2Quals.removeUnaligned();
- if (T1Quals == T2Quals)
+ if (T1Quals.compatiblyIncludes(T2Quals))
return Ref_Compatible;
- else if (T1Quals.compatiblyIncludes(T2Quals))
- return Ref_Compatible_With_Added_Qualification;
else
return Ref_Related;
}
@@ -4401,8 +4399,7 @@ TryReferenceInit(Sema &S, Expr *Init, Qu
// reference-compatible with "cv2 T2," or
//
// Per C++ [over.ics.ref]p4, we don't check the bit-field property here.
- if (InitCategory.isLValue() &&
- RefRelationship >= Sema::Ref_Compatible_With_Added_Qualification) {
+ if (InitCategory.isLValue() && RefRelationship == Sema::Ref_Compatible) {
// C++ [over.ics.ref]p1:
// When a parameter of reference type binds directly (8.5.3)
// to an argument expression, the implicit conversion sequence
@@ -4464,10 +4461,10 @@ TryReferenceInit(Sema &S, Expr *Init, Qu
//
// -- is an xvalue, class prvalue, array prvalue or function
// lvalue and "cv1 T1" is reference-compatible with "cv2 T2", or
- if (RefRelationship >= Sema::Ref_Compatible_With_Added_Qualification &&
+ if (RefRelationship == Sema::Ref_Compatible &&
(InitCategory.isXValue() ||
- (InitCategory.isPRValue() && (T2->isRecordType() || T2->isArrayType())) ||
- (InitCategory.isLValue() && T2->isFunctionType()))) {
+ (InitCategory.isPRValue() && (T2->isRecordType() || T2->isArrayType())) ||
+ (InitCategory.isLValue() && T2->isFunctionType()))) {
ICS.setStandard();
ICS.Standard.First = ICK_Identity;
ICS.Standard.Second = DerivedToBase? ICK_Derived_To_Base
More information about the cfe-commits
mailing list