Skip to content

fix DwarfLang constants to use LLVM C API source-language values #46

Description

@cpunion

DwarfLang is passed directly to LLVMDIBuilderCreateCompileUnit as LLVMDWARFSourceLanguage, but DW_LANG_Go is currently defined as the encoded DWARF wire value 0x0016.

The LLVM C API type is a zero-based enum, not the DWARF wire value. In current LLVM headers:

  • LLVMDWARFSourceLanguageGo is 21
  • value 22 (0x16) is LLVMDWARFSourceLanguageModula3

As a result, using llvm.DW_LANG_Go produces DW_LANG_Modula3 metadata instead of DW_LANG_Go.

The binding should expose the LLVM C enum values (ideally all source-language constants generated or mapped from llvm-c/DebugInfo.h) and include a test that creates a compile unit and verifies !DICompileUnit(language: DW_LANG_Go, ...).

This was found while validating the native LLDB Go language work tracked by xgo-dev/llgo#2154.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions