]> granicus.if.org Git - clang/commitdiff
simplify this predicate, only checking isObjCQualifiedIdType once.
authorChris Lattner <sabre@nondot.org>
Mon, 21 Jul 2008 04:03:34 +0000 (04:03 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 21 Jul 2008 04:03:34 +0000 (04:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53817 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/Sema.cpp

index 0e1a8ee56ebe4726ec2bc02aef52545e69f081b8..52858cb893e97fde4dff8253f4baf50c0ce240fa 100644 (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) {