From ef8a9518826b5b6b726eec66fd2fce6a3532ac66 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 5 May 2014 23:23:53 +0000 Subject: Build debug info for ObjC interface types at the end of the translation unit to ensure all ivars are included. This takes a different approach than the completedType/requiresCompleteType work which relies on AST callbacks to upgrade the type declaration to a definition. Instead, just defer constructing the definition to the end of the translation unit. This works because the definition is never needed by other debug info (so far as I know), whereas the definition of a struct may be needed by other debug info before the end of the translation unit (such as emitting the definition of a member function which must refer to that member function's declaration). If we had a callback for whenever an IVar was added to an ObjC interface we could use that, and remove the need for the ObjCInterfaceCache, which might be nice. (also would need a callback for when it was more than just a declaration so we could get properties, etc). A side benefit is that we also don't need the CompletedTypeCache anymore. Just rely on the declaration-ness of a type to decide whether its definition is yet to be emitted. There's still the PR19562 memory leak, but this should hopefully make that a bit easier to approach. llvm-svn: 208015 --- clang/test/CodeGenObjC/debug-info-ivars-indirect.m | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'clang/test/CodeGenObjC') diff --git a/clang/test/CodeGenObjC/debug-info-ivars-indirect.m b/clang/test/CodeGenObjC/debug-info-ivars-indirect.m index 8d1ab92d766..f9593d24dea 100644 --- a/clang/test/CodeGenObjC/debug-info-ivars-indirect.m +++ b/clang/test/CodeGenObjC/debug-info-ivars-indirect.m @@ -3,6 +3,14 @@ // Make sure we generate debug symbols for an indirectly referenced // extension to an interface. +// This happens to be the order the members are emitted in... I'm assuming it's +// not meaningful/important, so if something causes the order to change, feel +// free to update the test to reflect the new order. +// CHECK: ; [ DW_TAG_member ] [a] +// CHECK: ; [ DW_TAG_member ] [d] +// CHECK: ; [ DW_TAG_member ] [c] +// CHECK: ; [ DW_TAG_member ] [b] + @interface I { @public int a; @@ -29,7 +37,6 @@ void gorf (struct S* s) { int _b = s->i->b; } -// CHECK: ; [ DW_TAG_member ] [b] I *source(); @@ -39,8 +46,14 @@ I *source(); } @end -// CHECK: ; [ DW_TAG_member ] [c] - void use() { int _c = source()->c; } + +@interface I() +{ + @public int d; +} +@end + +I *x(); -- cgit v1.2.3