diff options
author | Chris Lattner <sabre@nondot.org> | 2008-07-21 04:03:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-07-21 04:03:34 +0000 |
commit | 2a47fa737273a5f2287e1087f9978a13ea493acf (patch) | |
tree | 06bebf71459d2aadffb3c822dc12d2c6cd35ea6e /clang/lib/Sema | |
parent | 56e328bb815d7a7c01b7b3963ffb8283616e5738 (diff) | |
download | bcm5719-llvm-2a47fa737273a5f2287e1087f9978a13ea493acf.tar.gz bcm5719-llvm-2a47fa737273a5f2287e1087f9978a13ea493acf.zip |
simplify this predicate, only checking isObjCQualifiedIdType once.
llvm-svn: 53817
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 0e1a8ee56eb..52858cb893e 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -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) { |