Don't crash if the AST doesn't have a sensible ObjC id type.

llvm-svn: 130500
This commit is contained in:
David Chisnall 2011-04-29 14:10:35 +00:00
parent 6708499b6d
commit 10d2ded910
1 changed files with 6 additions and 4 deletions

View File

@ -688,11 +688,13 @@ CGObjCGNU::CGObjCGNU(CodeGenModule &cgm, unsigned runtimeABIVersion,
PtrTy = PtrToInt8Ty;
// Object type
ASTIdTy = CGM.getContext().getCanonicalType(CGM.getContext().getObjCIdType());
if (QualType() == ASTIdTy) {
IdTy = PtrToInt8Ty;
} else {
QualType UnqualIdTy = CGM.getContext().getObjCIdType();
ASTIdTy = CanQualType();
if (UnqualIdTy != QualType()) {
ASTIdTy = CGM.getContext().getCanonicalType(UnqualIdTy);
IdTy = cast<llvm::PointerType>(CGM.getTypes().ConvertType(ASTIdTy));
} else {
IdTy = PtrToInt8Ty;
}
PtrToIdTy = llvm::PointerType::getUnqual(IdTy);