diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-07 06:52:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-07 06:52:53 +0000 |
commit | 8f8fc7bdb6f42ce31d46596d4c0660625773cbef (patch) | |
tree | 72c7740824bd412e0b3c2eae2ff591f7002a7812 | |
parent | 6ac46a4a521366d7ab36ebe2ce4e624ab96b06f9 (diff) |
simplify reference handling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49325 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/ASTContext.cpp | 17 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 2 |
2 files changed, 1 insertions, 18 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 187871b32e..e781040172 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1468,23 +1468,6 @@ bool ASTContext::pointerTypesAreCompatible(QualType lhs, QualType rhs) { return typesAreCompatible(ltype, rtype); } -// C++ 5.17p6: When the left operand of an assignment operator denotes a -// reference to T, the operation assigns to the object of type T denoted by the -// reference. -bool ASTContext::referenceTypesAreCompatible(QualType lhs, QualType rhs) { - QualType ltype = lhs; - - if (lhs->isReferenceType()) - ltype = cast<ReferenceType>(lhs.getCanonicalType())->getPointeeType(); - - QualType rtype = rhs; - - if (rhs->isReferenceType()) - rtype = cast<ReferenceType>(rhs.getCanonicalType())->getPointeeType(); - - return typesAreCompatible(ltype, rtype); -} - bool ASTContext::functionTypesAreCompatible(QualType lhs, QualType rhs) { const FunctionType *lbase = cast<FunctionType>(lhs.getCanonicalType()); const FunctionType *rbase = cast<FunctionType>(rhs.getCanonicalType()); diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index f0f05006f3..f4ef283985 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1179,7 +1179,7 @@ Sema::CheckAssignmentConstraints(QualType lhsType, QualType rhsType) { return Compatible; // Common case: fast path an exact match. if (lhsType->isReferenceType() || rhsType->isReferenceType()) { - if (Context.referenceTypesAreCompatible(lhsType, rhsType)) + if (Context.typesAreCompatible(lhsType, rhsType)) return Compatible; return Incompatible; } |