summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-04-07 00:27:04 +0000
committerChris Lattner <sabre@nondot.org>2008-04-07 00:27:04 +0000
commitba5862e74c202a5fd73777e1b58d4aebec703f7e (patch)
treebef2939080d62aee6467812be26427d2d4b5499a /clang/lib/AST/ASTContext.cpp
parent87e484f08b5f137bbc4384176890df4152dd8946 (diff)
downloadbcm5719-llvm-ba5862e74c202a5fd73777e1b58d4aebec703f7e.tar.gz
bcm5719-llvm-ba5862e74c202a5fd73777e1b58d4aebec703f7e.zip
clean up some logic in objc type handling. Specifically, make it so that
there are QualType::getAsObjc* type methods, and make isa<ObjCInterfaceType> return true for ObjCQualifiedInterfaceType's. llvm-svn: 49300
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 265804872d3..12eb5a15de3 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1427,17 +1427,18 @@ bool ASTContext::objcTypesAreCompatible(QualType lhs, QualType rhs) {
return true;
else if (isObjCIdType(lhs) && rhs->isObjCInterfaceType())
return true;
- if (ObjCInterfaceType *lhsIT =
- dyn_cast<ObjCInterfaceType>(lhs.getCanonicalType().getTypePtr())) {
- ObjCQualifiedInterfaceType *rhsQI =
- dyn_cast<ObjCQualifiedInterfaceType>(rhs.getCanonicalType().getTypePtr());
- return rhsQI && (lhsIT->getDecl() == rhsQI->getDecl());
+
+ if (const ObjCInterfaceType *lhsIT = lhs->getAsObjCInterfaceType()) {
+ const ObjCQualifiedInterfaceType *rhsQI =
+ rhs->getAsObjCQualifiedInterfaceType();
+ if (!isa<ObjCQualifiedInterfaceType>(lhsIT))
+ return rhsQI && (lhsIT->getDecl() == rhsQI->getDecl());
}
- else if (ObjCInterfaceType *rhsIT =
- dyn_cast<ObjCInterfaceType>(rhs.getCanonicalType().getTypePtr())) {
- ObjCQualifiedInterfaceType *lhsQI =
- dyn_cast<ObjCQualifiedInterfaceType>(lhs.getCanonicalType().getTypePtr());
- return lhsQI && (rhsIT->getDecl() == lhsQI->getDecl());
+ if (const ObjCInterfaceType *rhsIT = rhs->getAsObjCInterfaceType()) {
+ const ObjCQualifiedInterfaceType *lhsQI =
+ lhs->getAsObjCQualifiedInterfaceType();
+ if (!isa<ObjCQualifiedInterfaceType>(rhsIT))
+ return lhsQI && (rhsIT->getDecl() == lhsQI->getDecl());
}
return false;
}
OpenPOWER on IntegriCloud