[cfe-commits] r134972 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp lib/CodeGen/CodeGenTypes.cpp test/CodeGenCXX/init-incomplete-type.cpp

Francois Pichet pichet2000 at gmail.com
Tue Jul 12 01:47:45 PDT 2011


On Tue, Jul 12, 2011 at 2:52 AM, Chris Lattner <sabre at nondot.org> wrote:
> Author: lattner
> Date: Tue Jul 12 01:52:18 2011
> New Revision: 134972
>
> URL: http://llvm.org/viewvc/llvm-project?rev=134972&view=rev
> Log:
> Fix a problem Eli ran into where we now reject incomplete arrays of
> uncompleted struct types.  We now do what llvm-gcc does and compile
> them into [i8 x 0].  If the type is later completed, we make sure that
> it is appropriately cast.
>
> We compile the terrible example to something like this now:
>
> %struct.A = type { i32, i32, i32 }
>
> @g = external global [0 x i8]
>
> define void @_Z1fv() nounwind {
> entry:
>  call void @_Z3fooP1A(%struct.A* bitcast ([0 x i8]* @g to %struct.A*))
>  ret void
> }
>
> declare void @_Z3fooP1A(%struct.A*)
>
> define %struct.A* @_Z2f2v() nounwind {
> entry:
>  ret %struct.A* getelementptr inbounds ([0 x %struct.A]* bitcast ([0 x i8]* @g to [0 x %struct.A]*), i32 0, i64 1)
> }
>
>
>
>
> Modified:
>    cfe/trunk/lib/CodeGen/CGExpr.cpp
>    cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
>    cfe/trunk/test/CodeGenCXX/init-incomplete-type.cpp

This doesn't compile on Release mode with MSVC:
4>CGExpr.cpp(1295): error C2664: 'EmitBitCastOfLValueToProperType' :
cannot convert parameter 1 from 'clang::CodeGen::CGBuilderTy' to
'llvm::IRBuilder<> &'
4>CGExpr.cpp(1354): error C2664: 'EmitBitCastOfLValueToProperType' :
cannot convert parameter 1 from 'clang::CodeGen::CGBuilderTy' to
'llvm::IRBuilder<> &'
4>CGExpr.cpp(1855): error C2664: 'EmitBitCastOfLValueToProperType' :
cannot convert parameter 1 from 'clang::CodeGen::CGBuilderTy' to
'llvm::IRBuilder<> &'

Because on release CGF.Builder is actually a llvm::IRBuilder<false>




More information about the cfe-commits mailing list