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. - xi -------------- next part -------------- A non-text attachment was scrubbed... Name: clang.diff Type: application/octet-stream Size: 3302 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110618/36a5bfa1/attachment.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm.diff Type: application/octet-stream Size: 2868 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110618/36a5bfa1/attachment-0001.obj>
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 ? Please update createMemberType() directly, instead of creating new overloaded createMemberType(). Thanks, - Devang> > - xi > > > <clang.diff><llvm.diff>_______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
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).> 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. - xi
Possibly Parallel Threads
- [LLVMdev] [PATCH] Context of DW_TAG_member
- [DebugInfo][DIBuilder] Good way to pass arguments to createClassType/createMemberType
- [RFC PATCH 1/2] [clang]: Add AuxAttr support
- DW_TAG_member extends beyond the bounds error on Linux
- DW_TAG_member extends beyond the bounds error on Linux