diff options
author | Chris Lattner <sabre@nondot.org> | 2008-07-21 04:13:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-07-21 04:13:58 +0000 |
commit | 6886f38369296ca94776e93973937d500b26e9af (patch) | |
tree | 03ba5509330b61cdb5adda26c7773f1f4e760b66 /clang/lib/Sema/Sema.cpp | |
parent | c47d930448b031b1bbd89ebe5a579e76ecdb7b2c (diff) | |
download | bcm5719-llvm-6886f38369296ca94776e93973937d500b26e9af.tar.gz bcm5719-llvm-6886f38369296ca94776e93973937d500b26e9af.zip |
minor rename, also, reject pointer to qualified id.
id<NSCopyable>* is not an "objc pointer type", id<NSCopyable> is.
llvm-svn: 53820
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 4d1a0537798..478763190a6 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -26,24 +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 +/// 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) { |