[llvm-commits] [PATCH] PR14471: Debug info for static data members (LLVM part)

Eric Christopher echristo at gmail.com
Wed Jan 9 11:15:31 PST 2013


Hi Paul,

Few comments:

+; RUN: llc %s -o %t -filetype=obj -O0
+; RUN: llvm-dwarfdump %t | FileCheck %s -check-prefix=CHECK1
+; RUN: llvm-dwarfdump %t | FileCheck %s -check-prefix=CHECK2
+; PR14471

Can we get a comment on the two checks? I see why (or at least think I do)
you've got them, but it's not necessarily obvious. I think it's because it
makes it easier for you to check the things you're looking for.

+
+; ModuleID = 'debug-info-static-member.cpp'
+target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"

Go ahead and use an -mtriple flag on the llc command and delete these
lines. If there's no architecture specific need you can try to move it up
to the next higher directory.

+  /// a typedef, a pointer or reference, etc.; or, a data member of a
+  /// class/struct/union.

The ';' is awkward.

+/// getOrCreateContextDIE - Get context owner's DIE.
+DIE *CompileUnit::getOrCreateContextDIE(DIDescriptor Context)
+{

Formatting.

+/// createStaticMemberType - Create debugging information entry for a
+/// C++ static data member.
+DIType DIBuilder::createStaticMemberType(DIDescriptor Scope, StringRef
Name,
+                                         DIFile File, unsigned LineNumber,
+                                         DIType Ty, unsigned Flags,
+                                         llvm::Value *Val) {
+  assert(Flags & DIDescriptor::FlagStaticMember);
+  // TAG_member is encoded in DIDerivedType format.

If you're going to create a new function for creating static member types
why not just or the FlagStaticMember into the existing flags that are
passed down rather than making sure it already exists?

Looks good otherwise.

-eric



On Tue, Jan 8, 2013 at 5:16 PM, Robinson, Paul <Paul.Robinson at am.sony.com>wrote:

> New and improved patch for PR14471.
>
> - No more mock tag for static members; they use DW_TAG_member.
> - No more DIStaticDataMember; they use DIDerivedType.
>   This helps the scope of things somewhat, but I still have a number of
>   methods specific to static members; they are just different enough.
> - I had to revisit createGlobalVariableDIE(), because after staring at it,
>   I couldn't remember what it was doing or why.  It turns out it was not
>   completely correct, and now there's extra commentary to guide the unwary.
> - I figured out that the "isVariable" case under structures in
>   constructTypeDIE should be irrelevant now, so I took it out.
> - The test is beefed up.
>
> --paulr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130109/c5886548/attachment.html>


More information about the llvm-commits mailing list