From: David Chisnall Date: Fri, 29 Apr 2011 14:10:35 +0000 (+0000) Subject: Don't crash if the AST doesn't have a sensible ObjC id type. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7bcf6c3e098e808282cc96309c02c08ab6229940;p=clang Don't crash if the AST doesn't have a sensible ObjC id type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130500 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp index 2116dc6bf5..d28cfa57df 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/lib/CodeGen/CGObjCGNU.cpp @@ -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(CGM.getTypes().ConvertType(ASTIdTy)); + } else { + IdTy = PtrToInt8Ty; } PtrToIdTy = llvm::PointerType::getUnqual(IdTy);