<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Incorrect scope information for a struct in DWARF debug information"
   href="https://bugs.llvm.org/show_bug.cgi?id=40279">40279</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect scope information for a struct in DWARF debug information
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mbarbar@runbox.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21309" name="attach_21309" title="Source file containing incorrectly scoped struct">attachment 21309</a> <a href="attachment.cgi?id=21309&action=edit" title="Source file containing incorrectly scoped struct">[details]</a></span>
Source file containing incorrectly scoped struct

I was building Chrome with -g2 and trying to rebuild the class hierarchy graph
and came across this:

According to DWARF information, "__cxxabiv1::(anonymous
namespace)::scan_results" is being treated as "(anonymous
namespace)::scan_results".

Unfortunately I'm unsure how to reproduce, but here is what I ran into.

Relavant part from cxa_personality.cpp (full file attached):
namespace __cxxabiv1
{
extern "C"
{
namespace
{
struct scan_results
{
    // [A bunch of fields]
};
}
}
}
}

This is contained (file is too large to attach) when disassembling the
generated BC file:
!13342 = !DINamespace(scope: null)
!227745 = distinct !DICompositeType(tag: DW_TAG_structure_type, name:
"scan_results", scope: !13342, file: !16882, line: 503, size: 384, flags:
DIFlagTypePassByValue, elements: !227746)

So !13342 does not point to the scope it's contained in.

The struct itself is known elsewhere by it's fullname, e.g.
%"struct.__cxxabiv1::(anonymous namespace)::scan_results" = type { i64, i8*,
i8*, i64, i8*, i32 }</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>