<div dir="ltr">In the interests of centralizing the debug info metadata generation in one place (DIBuilder) the following patches (to DragonEgg, LLVM (to add a minor breaking API change), & Clang (to update for the breaking change) - any non-interesting API changes necessary have already been committed).<br>
<br>I'll be the first to admit that this is a fairly mechanical transformation, simply replacing the raw metadata generation inside DragonEgg's DIFactory with a nested DIBuilder. With further consideration it would be quite easy to remove DIFactory entirely & use DIBuilder directly. This would most obviously tidy up the switches in DIFactory::CreateCompositeType and DIFactory::CreateDerivedType.<div>
<br></div><div style>Beyond that there's a couple of finer points:<br>1) DIBuilder needed to be "finalized" - I chose to put that in DIFactory's dtor and add code to clean up the DIFactory at the appropriate point<br>
2) there's one case of raw MDNode creation for debug info metadata - see the comment in the DragonEgg patch starting "FIXME: Remove this conditional". If you remove it you can see the failure with a test case involving a pointer-to-member-variable typedef. (it seems the call to getOrCreateType at line 953 maybe needs to look through pointer-to-member-variable & create the type of the member being pointed to - that was a bit more involved that I was comfortable fixing, but fix welcome)</div>
<div style><br></div><div style>[side note: currently DragonEgg seems to produce all record types as "struct" debug info, never using "class" debug info - I'm sure this would account for several failures in the GDB test suite & some minor usability confusion for users<br>
<br>There is one test I'm still regressing (& a few that have improved with this patch) in the GDB 7.5 test suite: gdb.opt/inline-locals.exp, but I think that's just luck. It was mostly failing already, for slightly different reasons previously.]</div>
</div>