[cfe-commits] r45717 - /cfe/trunk/AST/ASTContext.cpp
Fariborz Jahanian
fjahanian at apple.com
Mon Jan 7 12:12:24 PST 2008
Author: fjahanian
Date: Mon Jan 7 14:12:21 2008
New Revision: 45717
URL: http://llvm.org/viewvc/llvm-project?rev=45717&view=rev
Log:
Verify/add code to make sure types passed to interfaceTypesAreCompatible
are canonical. Asst in interfaceTypesAreCompatible if they are not.
Modified:
cfe/trunk/AST/ASTContext.cpp
Modified: cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/ASTContext.cpp?rev=45717&r1=45716&r2=45717&view=diff
==============================================================================
--- cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/trunk/AST/ASTContext.cpp Mon Jan 7 14:12:21 2008
@@ -1250,7 +1250,13 @@
return false;
}
+/// Check that 'lhs' and 'rhs' are compatible interface types. Both types
+/// must be canonical types.
bool ASTContext::interfaceTypesAreCompatible(QualType lhs, QualType rhs) {
+ assert (lhs->isCanonical() &&
+ "interfaceTypesAreCompatible strip typedefs of lhs");
+ assert (rhs->isCanonical() &&
+ "interfaceTypesAreCompatible strip typedefs of rhs");
if (lhs == rhs)
return true;
ObjCInterfaceType *lhsIT = cast<ObjCInterfaceType>(lhs.getTypePtr());
@@ -1274,8 +1280,9 @@
ObjCQualifiedInterfaceType *rhsQI =
dyn_cast<ObjCQualifiedInterfaceType>(rhs.getCanonicalType().getTypePtr());
assert(rhsQI && "QualifiedInterfaceTypesAreCompatible - bad rhs type");
- if (!interfaceTypesAreCompatible(getObjCInterfaceType(lhsQI->getDecl()),
- getObjCInterfaceType(rhsQI->getDecl())))
+ if (!interfaceTypesAreCompatible(
+ getObjCInterfaceType(lhsQI->getDecl()).getCanonicalType(),
+ getObjCInterfaceType(rhsQI->getDecl()).getCanonicalType()))
return false;
/* All protocols in lhs must have a presense in rhs. */
for (unsigned i =0; i < lhsQI->getNumProtocols(); i++) {
More information about the cfe-commits
mailing list