Clang's approach to anonymous struct pointer parameters

For the following code:

    struct XBeePacket;
    
    typedef void (*CompletionProc)(XBeePacket* inPacket, void* inParam2);
    
    struct
    XBeePacket
    {
        bool mField1;
        CompletionProc mCompletionProc;
    };

Why does clang emit this IR?

    %struct.XBeePacket = type { i8, {}* }
    
    define void
    @MyCompletionProc(%struct.XBeePacket* %inPacket, i8* %inParam2)
        nounwind uwtable ssp
    {
    entry:
      ...
    }

It makes the struct field for the completion proc an an anonymous aggregate pointer. Is that better than making the first parameter to MyCompletionProc void* or something similar?

I guess there's no way in LLVM IR to forward-declare in a way that solves this, huh?

Hi Rick,

this is a bug in Clang's LLVM-IR code generator:
http://llvm.org/bugs/show_bug.cgi?id=14920

Best,
Florian

Hi Rick,

this is a bug in Clang's LLVM-IR code generator:
http://llvm.org/bugs/show_bug.cgi?id=14920

Oh, interesting, thanks.

How do I create a recursive definition like this?