simplify this predicate, only checking isObjCQualifiedIdType once.

llvm-svn: 53817
This commit is contained in:
Chris Lattner 2008-07-21 04:03:34 +00:00
parent 56e328bb81
commit 2a47fa7372
1 changed files with 9 additions and 4 deletions

View File

@ -26,18 +26,23 @@ bool Sema::isBuiltinObjCType(TypedefDecl *TD) {
strcmp(typeName, "SEL") == 0 || strcmp(typeName, "Protocol") == 0;
}
/// isObjCObjectPointerType - Returns true if type is an objective-c pointer
/// to an object type; such as "id", "Class", Intf*, id<P>, etc.
bool Sema::isObjCObjectPointerType(QualType type) const {
if (!type->isPointerType() && !type->isObjCQualifiedIdType())
if (type->isObjCQualifiedIdType())
return true;
if (!type->isPointerType())
return false;
if (type == Context.getObjCIdType() || type == Context.getObjCClassType() ||
type->isObjCQualifiedIdType())
if (type == Context.getObjCIdType() || type == Context.getObjCClassType())
return true;
if (type->isPointerType()) {
PointerType *pointerType = static_cast<PointerType*>(type.getTypePtr());
type = pointerType->getPointeeType();
}
return (type->isObjCInterfaceType() || type->isObjCQualifiedIdType());
return type->isObjCInterfaceType() || type->isObjCQualifiedIdType();
}
void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {