[PATCH] DW_TAG_typedef and DW_TAG_structure_type not emitted when typedef is used
David Blaikie
dblaikie at gmail.com
Mon Sep 15 15:00:31 PDT 2014
>>! In D2498#4, @jyoti.yalamanchili wrote:
> This bug appears only when typedef is used.
Doesn't look like it.
Changing the code to cast to (S*) instead of (T) still demonstrates the bug and is still present even with this patch applied.
The problem is more general than typedefs and casts - arguably we should get this (C++11) case too:
struct S { int i; };
void func(S);
void func() {
func(S{42});
}
but GCC doesn't get this either, so I'm less concerned.
GCC does get the cast case - with or without a typedef. So perhaps we can just deal with casts for now...
The only other thing I can think of is far more invasive/more work - to get this all right, what we really need is a tree of "completeness" - keeping track of any time a type is required to be complete (not just a single bit that says "this has been required to be complete") & then emitting any type for which it was requried to be complete during a function we codegen'd.
This infrastructure would also allow us to do a better job minimizing debug info for the limited debug info optimization where we currently fail:
struct foo { ... };
inline void unused() { foo f; } // 'f' is required to be complete here, but the function is never called
foo *f; // but that required completeness is never relied upon for this TU - a declaration would've sufficed
This hurts us in, for example, Clang's own Sema.h - the giant Sema class has a single non-member inline function right after it that has dereferences a Sema pointer, thus requiring Sema to be complete. From then on, if anything else in the TU including Sema.h requires Sema (evern just a pointer to it it) the debug info for the entire class will be emitted.
http://reviews.llvm.org/D2498
More information about the cfe-commits
mailing list