<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 18 Sep 2014, at 18:51, Frédéric Riss <<a href="mailto:friss@apple.com" class="">friss@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I pushed a partial revert in r218041 that should fix it.</div></div></blockquote><div><br class=""></div><div>I need some more sleep… I pushed a partial revert of r218041 in r218060 that should fix it.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Fred</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 18 Sep 2014, at 17:48, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Here's a simple example:<br class=""><br class="">  namespace x {<br class="">    int i = 3;<br class="">  }<br class="">  int j = x::i;<br class=""><br class="">LLVM will emit a declaration for 'i' in namespace x and a definition at the CU scope referencing the declaration. With your change, we end up omitting the DW_AT_declaration on the declaration of 'i'. The debugger then thinks it's a definition without a location, so any attempt to use/print the variable produces "this value has been optimized away".<br class=""><br class="">A couple of side notes:<br class=""><br class="">1) We should ideally not use "Verify()" for any debug info functionality - it should be enough to test "isBlah" methods. Any time isBlah is true but Verify fails is a bug we should fix at some point - I think that's a valid/useful invariant, but I could be wrong.<br class=""><br class="">2) we don't actually need to separate declaration and definition in this way, just because the variable is inside a namespace - so if you happen to fix this by removing the separation of declaration from definition, that's OK too (& a minor win to reduce debug info size)</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Sep 18, 2014 at 8:28 AM, Frédéric Riss <span dir="ltr" class=""><<a href="mailto:friss@apple.com" target="_blank" class="">friss@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On 18 Sep 2014, at 17:23, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Looks like this might've regressed some debug scenarios:<br class=""><br class=""><a href="http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/17377" target="_blank" class="">http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/17377</a><br class=""><br class="">(could be r218040, but it seems like the less likely candidate of the two on the blame list)</div></div></blockquote><div class=""><br class=""></div></span><div class="">I’ve seen it. I sent a mail to the review thread asking for some help from someone that can run the test suite.</div><div class=""><br class=""></div><div class="">Fred</div><div class=""><div class="h5"><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><div class="gmail_quote">On Thu, Sep 18, 2014 at 2:38 AM, Frederic Riss <span dir="ltr" class=""><<a href="mailto:friss@apple.com" target="_blank" class="">friss@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: friss<br class="">
Date: Thu Sep 18 04:38:23 2014<br class="">
New Revision: 218041<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=218041&view=rev" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=218041&view=rev</a><br class="">
Log:<br class="">
Always emit DW_AT_declaration attribute when the variable isn't a definition.<br class="">
<br class="">
Summary:<br class="">
This doesn't show up today as we don't emit decalration only variables. This<br class="">
will be tested when the followup patches implementing import of forward<br class="">
declared entities lands in clang.<br class="">
<br class="">
Reviewers: echristo, dblaikie, aprantl<br class="">
<br class="">
Subscribers: llvm-commits<br class="">
<br class="">
Differential Revision: <a href="http://reviews.llvm.org/D5382" target="_blank" class="">http://reviews.llvm.org/D5382</a><br class="">
<br class="">
Modified:<br class="">
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br class="">
<br class="">
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=218041&r1=218040&r2=218041&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=218041&r1=218040&r2=218041&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)<br class="">
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Thu Sep 18 04:38:23 2014<br class="">
@@ -1670,6 +1670,9 @@ void DwarfCompileUnit::createGlobalVaria<br class="">
       DD->addArangeLabel(SymbolCU(this, Sym));<br class="">
       addOpAddress(*Loc, Sym);<br class="">
     }<br class="">
+    // A static member's declaration is already flagged as such.<br class="">
+    if (!SDMDecl.Verify() && !GV.isDefinition())<br class="">
+      addFlag(*VariableDIE, dwarf::DW_AT_declaration);<br class="">
     // Do not create specification DIE if context is either compile unit<br class="">
     // or a subprogram.<br class="">
     if (GVContext && GV.isDefinition() && !GVContext.isCompileUnit() &&<br class="">
@@ -1678,9 +1681,6 @@ void DwarfCompileUnit::createGlobalVaria<br class="">
       VariableSpecDIE = &createAndAddDIE(dwarf::DW_TAG_variable, UnitDie);<br class="">
       addDIEEntry(*VariableSpecDIE, dwarf::DW_AT_specification, *VariableDIE);<br class="">
       addBlock(*VariableSpecDIE, dwarf::DW_AT_location, Loc);<br class="">
-      // A static member's declaration is already flagged as such.<br class="">
-      if (!SDMDecl.Verify())<br class="">
-        addFlag(*VariableDIE, dwarf::DW_AT_declaration);<br class="">
     } else {<br class="">
       addBlock(*VariableDIE, dwarf::DW_AT_location, Loc);<br class="">
     }<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
llvm-commits mailing list<br class="">
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank" class="">llvm-commits@cs.uiuc.edu</a><br class="">
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br class="">
</blockquote></div><br class=""></div>
</div></blockquote></div></div></div><br class=""></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></body></html>