summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-04-07 05:37:56 +0000
committerChris Lattner <sabre@nondot.org>2008-04-07 05:37:56 +0000
commitaee96c3a90bb1dbc6efa36e075c3e57e16b3d29d (patch)
tree3b58e8ee8e13d156ae341d870fa342de0926f2f1 /clang
parentf8a6b4d4fcf158743eaea13c981d13d950f03cab (diff)
downloadbcm5719-llvm-aee96c3a90bb1dbc6efa36e075c3e57e16b3d29d.tar.gz
bcm5719-llvm-aee96c3a90bb1dbc6efa36e075c3e57e16b3d29d.zip
Fix comment typo, do reference eval at the correct type.
llvm-svn: 49315
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/ASTContext.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 31537947a0d..bd914fd9840 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1628,14 +1628,6 @@ bool ASTContext::typesAreCompatible(QualType LHS_NC, QualType RHS_NC) {
QualType LHS = LHS_NC.getCanonicalType();
QualType RHS = RHS_NC.getCanonicalType();
- // If two types are identical, they are are compatible
- if (LHS == RHS)
- return true;
-
- if (LHS.getCVRQualifiers() != RHS.getCVRQualifiers() ||
- LHS.getAddressSpace() != RHS.getAddressSpace())
- return false;
-
// C++ [expr]: If an expression initially has the type "reference to T", the
// type is adjusted to "T" prior to any further analysis, the expression
// designates the object or function denoted by the reference, and the
@@ -1645,6 +1637,15 @@ bool ASTContext::typesAreCompatible(QualType LHS_NC, QualType RHS_NC) {
if (ReferenceType *RT = dyn_cast<ReferenceType>(RHS))
RHS = RT->getPointeeType();
+ // If two types are identical, they are compatible.
+ if (LHS == RHS)
+ return true;
+
+ // If qualifiers differ, the types are different.
+ if (LHS.getCVRQualifiers() != RHS.getCVRQualifiers() ||
+ LHS.getAddressSpace() != RHS.getAddressSpace())
+ return false;
+
Type::TypeClass LHSClass = LHS->getTypeClass();
Type::TypeClass RHSClass = RHS->getTypeClass();
OpenPOWER on IntegriCloud