fix several problems with the protocol qualified id handling where id was implicit.
First, fix canonical type handling of these, since protocol qualified id's are always canonical. Next, enhance SemaType to actually make these when used (instead of int) allowing them to actually be used when appropriate. Finally remove a bunch of logic relating to the mishandling of canonical types with protocol-qual id's. This fixes rdar://5986251 llvm-svn: 54083
This commit is contained in:
@@ -929,8 +929,7 @@ QualType ASTContext::getObjCQualifiedInterfaceType(ObjCInterfaceDecl *Decl,
|
||||
|
||||
/// getObjCQualifiedIdType - Return an ObjCQualifiedIdType for the 'id' decl
|
||||
/// and the conforming protocol list.
|
||||
QualType ASTContext::getObjCQualifiedIdType(QualType idType,
|
||||
ObjCProtocolDecl **Protocols,
|
||||
QualType ASTContext::getObjCQualifiedIdType(ObjCProtocolDecl **Protocols,
|
||||
unsigned NumProtocols) {
|
||||
// Sort the protocol list alphabetically to canonicalize it.
|
||||
SortAndUniqueProtocols(Protocols, NumProtocols);
|
||||
@@ -940,21 +939,11 @@ QualType ASTContext::getObjCQualifiedIdType(QualType idType,
|
||||
|
||||
void *InsertPos = 0;
|
||||
if (ObjCQualifiedIdType *QT =
|
||||
ObjCQualifiedIdTypes.FindNodeOrInsertPos(ID, InsertPos))
|
||||
ObjCQualifiedIdTypes.FindNodeOrInsertPos(ID, InsertPos))
|
||||
return QualType(QT, 0);
|
||||
|
||||
// No Match;
|
||||
QualType Canonical;
|
||||
if (!idType->isCanonical()) {
|
||||
Canonical = getObjCQualifiedIdType(getCanonicalType(idType),
|
||||
Protocols, NumProtocols);
|
||||
ObjCQualifiedIdType *NewQT =
|
||||
ObjCQualifiedIdTypes.FindNodeOrInsertPos(ID, InsertPos);
|
||||
assert(NewQT == 0 && "Shouldn't be in the map!");
|
||||
}
|
||||
|
||||
ObjCQualifiedIdType *QType =
|
||||
new ObjCQualifiedIdType(Canonical, Protocols, NumProtocols);
|
||||
ObjCQualifiedIdType *QType = new ObjCQualifiedIdType(Protocols, NumProtocols);
|
||||
Types.push_back(QType);
|
||||
ObjCQualifiedIdTypes.InsertNode(QType, InsertPos);
|
||||
return QualType(QType, 0);
|
||||
|
||||
Reference in New Issue
Block a user