From 10d2ded91061374a6d14ce0ff2630a8627c1b21c Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Fri, 29 Apr 2011 14:10:35 +0000 Subject: Don't crash if the AST doesn't have a sensible ObjC id type. llvm-svn: 130500 --- clang/lib/CodeGen/CGObjCGNU.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'clang/lib/CodeGen') diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index 2116dc6bf50..d28cfa57df0 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/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); -- cgit v1.2.3