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.
DwarfLangis passed directly toLLVMDIBuilderCreateCompileUnitasLLVMDWARFSourceLanguage, butDW_LANG_Gois currently defined as the encoded DWARF wire value0x0016.The LLVM C API type is a zero-based enum, not the DWARF wire value. In current LLVM headers:
LLVMDWARFSourceLanguageGois 210x16) isLLVMDWARFSourceLanguageModula3As a result, using
llvm.DW_LANG_GoproducesDW_LANG_Modula3metadata instead ofDW_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.