IR: Handle self-referencing DICompositeTypes in DIBuilder
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 18 Dec 2014 00:46:16 +0000 (00:46 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 18 Dec 2014 00:46:16 +0000 (00:46 +0000)
commit97f07c2778d5a82bae0418e1f05f44baa388c046
tree7ba9903562e9aff04d23e6e9fb7673ec2b13d7f2
parentd927bd8d15183809789c875ba7371e92145a688e
IR: Handle self-referencing DICompositeTypes in DIBuilder

Add API to DIBuilder to handle self-referencing `DICompositeType`s.

Self-references aren't expected in the debug info graph, and we take
advantage of that by only calling `resolveCycles()` on nodes that were
once forward declarations (otherwise, DIBuilder needs an expensive
tracking reference to every unresolved node it creates, which in cyclic
graphs is *all of them*).

However, clang seems to create self-referencing `DICompositeType`s.  Add
API to manage this safely.  The paired commit to clang will include the
regression test.

I'll make the `DICompositeType` API `private` in a follow-up to prevent
misuse (I've separated that to prevent build failures from missing the
clang commit).

llvm-svn: 224482
llvm/include/llvm/IR/DIBuilder.h
llvm/lib/IR/DIBuilder.cpp