<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Dec 20, 2016 at 1:01 PM Greg Clayton via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">clayborg added a comment.<br class="gmail_msg">
<br class="gmail_msg">
I will update the test cases to not add attributes and not do all the variants. David: let me know if you agree with my assessment on the A1 sibling case.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
================<br class="gmail_msg">
Comment at: lib/DebugInfo/DWARF/DWARFUnit.cpp:416<br class="gmail_msg">
+      return getDIEAtIndex(I);<br class="gmail_msg">
+  }<br class="gmail_msg">
+  return DWARFDie();<br class="gmail_msg">
----------------<br class="gmail_msg">
Actually it won't because your example actually looks like:<br class="gmail_msg">
<br class="gmail_msg">
```<br class="gmail_msg">
A<br class="gmail_msg">
  A1<br class="gmail_msg">
  NULL<br class="gmail_msg">
B<br class="gmail_msg">
  B1<br class="gmail_msg">
  NULL<br class="gmail_msg">
NULL<br class="gmail_msg">
```<br class="gmail_msg">
<br class="gmail_msg">
So the sibling of "A1" would be the first NULL and that NULL wouldn't return a sibling (see line 409).<br class="gmail_msg"></blockquote><div><br>Ah, fair enough.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I can modify the test case to test this though as a follow on patch I was going to do was to actually not store the NULL dies in the DieArray. </blockquote><div><br></div><div>Sure, sounds good.<br><br>I'd probably suggest adding the test now - to demonstrate this works today, then when you remove NULL dies, it should continue to work/not regress. (though perhaps the API will look different when you remove NULL dies, I'm not sure)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The NULL dies take up a lot of memory, but if I remove them, then I will need to make sure the above function behaves correctly by watching for a depth to go lower than the current depth, so adding a test as you mentioned is a good idea.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
================<br class="gmail_msg">
Comment at: unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp:1004<br class="gmail_msg">
+  Arg2Die.addAttribute(DW_AT_name, DW_FORM_strp, "j");<br class="gmail_msg">
+  Arg2Die.addAttribute(DW_AT_type, DW_FORM_ref_addr, IntDie);<br class="gmail_msg">
+<br class="gmail_msg">
----------------<br class="gmail_msg">
Yeah, I can remove them. I was thinking about that as I was making the test.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
================<br class="gmail_msg">
Comment at: unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp:1112<br class="gmail_msg">
+  TestRelations<4, AddrType>();<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
----------------<br class="gmail_msg">
Sounds good, I will just do a single variation for this then.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<a href="https://reviews.llvm.org/D27995" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D27995</a><br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
</blockquote></div></div>