I’m having this assertion fail when I was using DIBuilder to create the debug information:

Expected no forward declarations!

The assertion condition is: !isa (MD)

So My questions are:

  1. What is exactly the MDNodeFwdDecl ? I saw it’s in the latest release 3.6.1, but I also found this link

saying that MDNodeFwdDecl has been removed, and neither can I find class reference of it on the llvm doxgen website. So is it still valid ??

  1. How and when will it be generated when I use DIBuilder module ?


Any ideas ?


I suspect you've neglected to call `DIBuilder::finalize()`.

On trunk, `isa<MDNodeFwdDecl>(N)` has become `N.isTemporary()`. There
are a number of temporaries created in the debug info graph to facilitate
building cycles, and `DIBuilder::finalize()` (1) cleans them up, and (2)
resolves other nodes involved in the cycles.

It looks like we don't archive old doxygen files, but you should be
able to build it yourself for old versions.

Hello, Duncan

Thanks for the help。

I’ve double checked my code and I did call finalize(), and it worked for llvm 3.3, but failed on 3.6. Is there any other possibility that can lead to this error ?


(Wow, 3.3 is old.)

I think some of the interfaces in DIBuilder now return a temporary
node that didn't before (I wasn't involved in that work, so I don't
know if it's from new API, or if the old API changed).

Otherwise, I can't think of anything off the top of my head. Let
me know what you discover.