summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-10-21 23:01:55 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-10-21 23:01:55 +0000
commitce76629905aa1a288613c22d85eed972123f5ee3 (patch)
tree7a34196dfdba58b1ac84a6b86364621abe4965a9 /clang/lib/Sema
parent566b34d9b7c76a47e5077fd633209bf3c5674c5a (diff)
downloadbcm5719-llvm-ce76629905aa1a288613c22d85eed972123f5ee3.tar.gz
bcm5719-llvm-ce76629905aa1a288613c22d85eed972123f5ee3.zip
Remove unnecessary distinction between Ref_Compatible and
Ref_Compatible_With_Added_Qualification. We always treated these two values the same way. llvm-svn: 284895
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaCast.cpp2
-rw-r--r--clang/lib/Sema/SemaInit.cpp7
-rw-r--r--clang/lib/Sema/SemaOverload.cpp13
3 files changed, 9 insertions, 13 deletions
diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp
index e19020c6ade..43fdf590424 100644
--- a/clang/lib/Sema/SemaCast.cpp
+++ b/clang/lib/Sema/SemaCast.cpp
@@ -1165,7 +1165,7 @@ TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, QualType DestType,
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;
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index c6a773cf8fa..f5e38b4fbdf 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -4263,7 +4263,7 @@ static void TryReferenceInitializationCore(Sema &S,
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 TryReferenceInitializationCore(Sema &S,
// "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 TryReferenceInitializationCore(Sema &S,
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);
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 8d6c562dd0c..a39ad58c4fa 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -4220,10 +4220,8 @@ Sema::CompareReferenceRelationship(SourceLocation Loc,
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, QualType DeclType,
// 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, QualType DeclType,
//
// -- 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
OpenPOWER on IntegriCloud