[cfe-commits] r53817 - /cfe/trunk/lib/Sema/Sema.cpp
Chris Lattner
sabre at nondot.org
Sun Jul 20 21:03:34 PDT 2008
Author: lattner
Date: Sun Jul 20 23:03:34 2008
New Revision: 53817
URL: http://llvm.org/viewvc/llvm-project?rev=53817&view=rev
Log:
simplify this predicate, only checking isObjCQualifiedIdType once.
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=53817&r1=53816&r2=53817&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Sun Jul 20 23:03:34 2008
@@ -26,18 +26,23 @@
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) {
More information about the cfe-commits
mailing list