[cfe-commits] r49325 - in /cfe/trunk/lib: AST/ASTContext.cpp Sema/SemaExpr.cpp

Chris Lattner sabre at nondot.org
Sun Apr 6 23:52:53 PDT 2008


Author: lattner
Date: Mon Apr  7 01:52:53 2008
New Revision: 49325

URL: http://llvm.org/viewvc/llvm-project?rev=49325&view=rev
Log:
simplify reference handling.

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=49325&r1=49324&r2=49325&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Apr  7 01:52:53 2008
@@ -1468,23 +1468,6 @@
   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());

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=49325&r1=49324&r2=49325&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Apr  7 01:52:53 2008
@@ -1179,7 +1179,7 @@
     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;
   }





More information about the cfe-commits mailing list