[cfe-commits] r53820 - /cfe/trunk/lib/Sema/Sema.cpp

Chris Lattner sabre at nondot.org
Sun Jul 20 21:13:58 PDT 2008


Author: lattner
Date: Sun Jul 20 23:13:58 2008
New Revision: 53820

URL: http://llvm.org/viewvc/llvm-project?rev=53820&view=rev
Log:
minor rename, also, reject pointer to qualified id.
id<NSCopyable>*  is not an "objc pointer type", id<NSCopyable> is.


Modified:
    cfe/trunk/lib/Sema/Sema.cpp

Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=53820&r1=53819&r2=53820&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Sun Jul 20 23:13:58 2008
@@ -26,24 +26,23 @@
          strcmp(typeName, "SEL") == 0 || strcmp(typeName, "Protocol") == 0;
 }
 
-/// isObjCObjectPointerType - Returns true if type is an objective-c pointer
+/// 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->isObjCQualifiedIdType())
+bool Sema::isObjCObjectPointerType(QualType Ty) const {
+  if (Ty->isObjCQualifiedIdType())
     return true;
   
-  if (!type->isPointerType())
+  if (!Ty->isPointerType())
     return false;
   
   // Check to see if this is 'id' or 'Class', both of which are typedefs for
   // pointer types.  This looks for the typedef specifically, not for the
   // underlying type.
-  if (type == Context.getObjCIdType() || type == Context.getObjCClassType())
+  if (Ty == Context.getObjCIdType() || Ty == Context.getObjCClassType())
     return true;
   
-  const PointerType *pointerType = type->getAsPointerType();
-  type = pointerType->getPointeeType();
-  return type->isObjCInterfaceType() || type->isObjCQualifiedIdType();
+  // If this a pointer to an interface (e.g. NSString*), it is ok.
+  return Ty->getAsPointerType()->getPointeeType()->isObjCInterfaceType();
 }
 
 void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {





More information about the cfe-commits mailing list