<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 - [DebugInfo] Missing debug-info for `enums` declared inside a C function"
   href="https://bugs.llvm.org/show_bug.cgi?id=49153">49153</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[DebugInfo] Missing debug-info for `enums` declared inside a C function
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>DebugInfo
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>sourav0311@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>aloksharma.knit@gmail.com, aprantl@apple.com, dblaikie@gmail.com, jdevlieghere@apple.com, jini.susan.george@gmail.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul.robinson@am.sony.com, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$cat enum.c

int main() {
enum {
        Hello = 1,
};
        printf("%d\n", Hello);
}
---------------------------------

DWARF generated by CLANG(trunk):
0x0000000b: DW_TAG_compile_unit
     ...
0x0000002a:   DW_TAG_subprogram
                DW_AT_name      ("main")
        ...
0x00000043:   DW_TAG_base_type
                DW_AT_name      ("int")
           ...
0x0000004a:   NULL
--------------------------------------

DWARF generated by GCC(trunk):
x0000002e:   DW_TAG_subprogram
                DW_AT_name      ("main")
             ...
0x00000050:     DW_TAG_enumeration_type
                  DW_AT_encoding        (DW_ATE_unsigned)
                  DW_AT_byte_size       (0x04)
                  DW_AT_type    (0x0000007f "unsigned int")
              ...

0x0000005e:       DW_TAG_enumerator
                    DW_AT_name  ("Hello")
                    DW_AT_const_value   (0x01)
--------------------------------------------

I think this is mostly due to design of enums in debug-info. Enums are
represented as part of CompileUnit as:

!0 = distinct !DICompileUnit(..... enums: !2, ....)

While this works well for cases when enum is at Global/CU scope, but leaves no
room for addressing the case depicted here, i.e Enum declared inside a
function.</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>