]> granicus.if.org Git - clang/commitdiff
simplify reference handling.
authorChris Lattner <sabre@nondot.org>
Mon, 7 Apr 2008 06:52:53 +0000 (06:52 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 7 Apr 2008 06:52:53 +0000 (06:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49325 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp
lib/Sema/SemaExpr.cpp

index 187871b32e00763256bb44e6a0aae555acb6ee1e..e781040172c0b1d23ce0c8eb809580b1b7b1a475 100644 (file)
@@ -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());
index f0f05006f37375ca6d0ce64d8107d1c198d2f05f..f4ef2839855b803af6b164ec4f3d470449f4de88 100644 (file)
@@ -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;
   }