https://bugs.llvm.org/show_bug.cgi?id=49153

            Bug ID: 49153
           Summary: [DebugInfo] Missing debug-info for `enums` declared
                    inside a C function
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedb...@nondot.org
          Reporter: sourav0...@gmail.com
                CC: aloksharma.k...@gmail.com, apra...@apple.com,
                    dblai...@gmail.com, jdevliegh...@apple.com,
                    jini.susan.geo...@gmail.com, keith.wal...@arm.com,
                    llvm-bugs@lists.llvm.org, paul.robin...@am.sony.com,
                    paul_robin...@playstation.sony.com

$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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to