Getting an Allocaed block into an Expr


I have the following problem in creating a custom function call. I want to reuse CodeGenFunction::EmitCallArgs, since it seems to be solving some tricky issues with MS compilers.

At the time I want to call `EmitCallArgs` I have all my arguments ready, except one, which I am allocaing on the fly like this:

LValue Record = MakeNaturalAlignAddrLValue( CreateMemTemp( RecTy, "_additional"), RecTy);

So now I have an (LLVM) LValue but EmitCallArgs expects an iterator of (CLANG) Expr *. So I would like to fake a temporary pointer expression to my allocaed record add it to my arguments and call EmitCallArgs. But I haven't found a place in clang, that creates a pointer expr to a LLVM LValue. Maybe it's impossible ?

Thanks for any help in advance

You should be able to use EmitCallArgs to get most of the CallArgList and add your CallArg either at the beginning or end of the argument sequence, depending on where you want it. This is how we do constructor calls, for example. As long as your argument is a scalar and not an aggregate, this will work just fine, it’s like the way we handle the ‘this’ parameter separately in EmitCXXConstructorCall.