Fix <rdar://problem/7330784>. Avoid crashing on 'Class<p>' when generating meta-data for a class.

llvm-svn: 85440
This commit is contained in:
Steve Naroff 2009-10-28 22:03:49 +00:00
parent 14f162d9dc
commit f0c8611d3f
2 changed files with 8 additions and 4 deletions

View File

@ -3419,7 +3419,10 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
return;
}
if (OPT->isObjCClassType()) {
if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType()) {
// FIXME: Consider if we need to output qualifiers for 'Class<p>'.
// Since this is a binary compatibility issue, need to consult with runtime
// folks. Fortunately, this is a *very* obsure construct.
S += '#';
return;
}
@ -3457,9 +3460,9 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
}
S += '@';
if (FD || EncodingProperty) {
if (OPT->getInterfaceDecl() && (FD || EncodingProperty)) {
S += '"';
S += OPT->getInterfaceDecl()->getNameAsCString();
S += OPT->getInterfaceDecl()->getIdentifier()->getName();
for (ObjCObjectPointerType::qual_iterator I = OPT->qual_begin(),
E = OPT->qual_end(); I != E; ++I) {
S += '<';

View File

@ -3,7 +3,7 @@
// RUN: grep -e "@\\\22<X><Y>\\\22" %t &&
// RUN: grep -e "@\\\22<X><Y><Z>\\\22" %t &&
// RUN: grep -e "@\\\22Foo<X><Y><Z>\\\22" %t &&
// RUN: grep -e "{Intf=@@@@}" %t
// RUN: grep -e "{Intf=@@@@#}" %t
@protocol X, Y, Z;
@class Foo;
@ -17,6 +17,7 @@ id <X> IVAR_x;
id <X, Y> IVAR_xy;
id <X, Y, Z> IVAR_xyz;
Foo <X, Y, Z> *IVAR_Fooxyz;
Class <X> IVAR_Classx;
}
@end