[cfe-commits] r130500 - /cfe/trunk/lib/CodeGen/CGObjCGNU.cpp

jahanian fjahanian at apple.com
Fri Apr 29 08:46:29 PDT 2011


Shouldn't this be caught at Sema type? A test case would clarify the situation.

- Fariborz

On Apr 29, 2011, at 7:10 AM, David Chisnall wrote:

> Author: theraven
> Date: Fri Apr 29 09:10:35 2011
> New Revision: 130500
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=130500&view=rev
> Log:
> Don't crash if the AST doesn't have a sensible ObjC id type.
> 
> 
> Modified:
>    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
> 
> Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=130500&r1=130499&r2=130500&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Fri Apr 29 09:10:35 2011
> @@ -688,11 +688,13 @@
>   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);
> 
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list