[cfe-dev] [LLVMdev] [PATCH] Context of DW_TAG_member
Devang Patel
dpatel at apple.com
Thu Jun 23 15:58:54 PDT 2011
On Jun 20, 2011, at 10:55 AM, Xi Wang wrote:
> On Jun 20, 2011, at 1:00 PM, Devang Patel wrote:
>> On Jun 18, 2011, at 3:14 PM, Xi Wang wrote:
>>
>>> Hi,
>>>
>>> When generating debugging information for a data member (e.g., a struct field), Clang doesn't set the member's context to the enclosed class/struct/union type --- it currently sets the context to the file instead. The attached patch corrects this. Thanks.
>>
>> Do you have a test case ?
>
> I guess the following case should be able to demonstrate the problem.
>
> // RUN: %clang_cc1 -emit-llvm -g < %s | grep DW_TAG_member | grep \!3
>
> struct A { int x; } a;
>
> Compile it with -g. `grep DW_TAG_member' should give the line
>
> !5 = metadata !{i32 589837, metadata !2, metadata !"x", metadata !2, i32 2, i64 32, i64 32, i64 0, i32 0, metadata !6} ; [ DW_TAG_member ]
>
> Currently the second entry of the tuple is !2 (the file), which should have been !3 (the struct A).
That works. Actually, I was curious, how did you run into this issue ?
>
>> Please update createMemberType() directly, instead of creating new overloaded createMemberType().
>
> You are right. The ideal fix would be adding a "Context" parameter to createMemberType(). However doing so would require a lot of changes in CGDebugInfo.cpp because most calls to createMemberType (in CGDebugInfo.cpp) do not provide a context at all. If a large fix sounds ok I will make a new patch.
Large fix OK. Please include test case in new patch.
Thanks,
-
Devang
More information about the cfe-dev
mailing list