[cfe-commits] r49137 - /cfe/trunk/lib/AST/ASTContext.cpp
Chris Lattner
sabre at nondot.org
Wed Apr 2 22:07:04 PDT 2008
Author: lattner
Date: Thu Apr 3 00:07:04 2008
New Revision: 49137
URL: http://llvm.org/viewvc/llvm-project?rev=49137&view=rev
Log:
qualifier comparisons should be done on canonical types.
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=49137&r1=49136&r2=49137&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu Apr 3 00:07:04 2008
@@ -1801,16 +1801,16 @@
/// C99 6.2.7p1: Two types have compatible types if their types are the
/// same. See 6.7.[2,3,5] for additional rules.
bool ASTContext::typesAreCompatible(QualType lhs, QualType rhs) {
- if (lhs.getCVRQualifiers() != rhs.getCVRQualifiers() ||
- lhs.getAddressSpace() != rhs.getAddressSpace())
- return false;
-
QualType lcanon = lhs.getCanonicalType();
QualType rcanon = rhs.getCanonicalType();
-
+
// If two types are identical, they are are compatible
if (lcanon == rcanon)
return true;
+
+ if (lcanon.getCVRQualifiers() != rcanon.getCVRQualifiers() ||
+ lcanon.getAddressSpace() != rcanon.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
More information about the cfe-commits
mailing list