summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/Sema.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 52858cb893e..4d1a0537798 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -35,13 +35,14 @@ bool Sema::isObjCObjectPointerType(QualType type) const {
if (!type->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())
return true;
- if (type->isPointerType()) {
- PointerType *pointerType = static_cast<PointerType*>(type.getTypePtr());
- type = pointerType->getPointeeType();
- }
+ const PointerType *pointerType = type->getAsPointerType();
+ type = pointerType->getPointeeType();
return type->isObjCInterfaceType() || type->isObjCQualifiedIdType();
}
OpenPOWER on IntegriCloud