Index: llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp =================================================================== --- llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp +++ llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp @@ -223,6 +223,7 @@ Encoding == dwarf::DW_ATE_signed_char || Encoding == dwarf::DW_ATE_float || Encoding == dwarf::DW_ATE_UTF || Encoding == dwarf::DW_ATE_boolean || + Encoding == dwarf::DW_ATE_complex_float || (Ty->getTag() == dwarf::DW_TAG_unspecified_type && Ty->getName() == "decltype(nullptr)")) && "Unsupported encoding"); Index: llvm/test/DebugInfo/X86/DW_ATE_complex_float.ll =================================================================== --- /dev/null +++ llvm/test/DebugInfo/X86/DW_ATE_complex_float.ll @@ -0,0 +1,39 @@ +; RUN: llc %s -o - | FileCheck %s + +;; Check a single location variable of type DW_ATE_complex_float with a +;; constant value is emitted with a DW_AT_const_value attribute. + +;; Modified from C source input: +;; #include +;; void f() { double complex r1; } + +; CHECK: .Ldebug_info_start0: +; CHECK: .byte 0 # DW_AT_const_value + +target triple = "x86_64-unknown-linux-gnu" + +define dso_local void @f() local_unnamed_addr !dbg !10 { +entry: + call void @llvm.dbg.value(metadata i8 0, metadata !14, metadata !DIExpression()), !dbg !17 + ret void, !dbg !19 +} + +declare void @llvm.dbg.value(metadata, metadata, metadata) + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!2, !3} +!llvm.ident = !{!9} + +!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 17.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) +!1 = !DIFile(filename: "test.c", directory: "/") +!2 = !{i32 7, !"Dwarf Version", i32 5} +!3 = !{i32 2, !"Debug Info Version", i32 3} +!9 = !{!"clang version 17.0.0"} +!10 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 2, type: !11, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !13) +!11 = !DISubroutineType(types: !12) +!12 = !{null} +!13 = !{!14} +!14 = !DILocalVariable(name: "r1", scope: !10, file: !1, line: 3, type: !15) +!15 = !DIBasicType(name: "complex", size: 128, encoding: DW_ATE_complex_float) +!17 = !DILocation(line: 0, scope: !10) +!19 = !DILocation(line: 4, column: 1, scope: !10)