forked from OSchip/llvm-project
Fix a crash that can happen when you have typedefs for pointers to
interfaces. Just because they x->isPointerType() doesn't mean it is valid to just cast to a pointertype. We have to handle typedefs etc as well. llvm-svn: 53819
This commit is contained in:
parent
15727f69fa
commit
c47d930448
|
@ -35,13 +35,14 @@ bool Sema::isObjCObjectPointerType(QualType type) const {
|
||||||
if (!type->isPointerType())
|
if (!type->isPointerType())
|
||||||
return false;
|
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 (type == Context.getObjCIdType() || type == Context.getObjCClassType())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (type->isPointerType()) {
|
const PointerType *pointerType = type->getAsPointerType();
|
||||||
PointerType *pointerType = static_cast<PointerType*>(type.getTypePtr());
|
type = pointerType->getPointeeType();
|
||||||
type = pointerType->getPointeeType();
|
|
||||||
}
|
|
||||||
return type->isObjCInterfaceType() || type->isObjCQualifiedIdType();
|
return type->isObjCInterfaceType() || type->isObjCQualifiedIdType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue