Yep - given this source code:
struct foo {
static auto f1();
};
auto foo::f1() {
return 3;
}
The current LLVM IR generated is:
!7 = distinct !DISubprogram(name: “f1”, linkageName: “_ZN3foo2f1Ev”, scope: !8, file: !1, line: 4, type: !9, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !12, retainedNodes: !2)
!8 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: “foo”, file: !1, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !2, identifier: “_ZTS3foo”)
!9 = !DISubroutineType(types: !10)
!10 = !{!11}
!11 = !DIBasicType(name: “int”, size: 32, encoding: DW_ATE_signed)
!12 = !DISubprogram(name: “f1”, linkageName: “_ZN3foo2f1Ev”, scope: !8, file: !1, line: 2, type: !9, scopeLine: 2, flags: DIFlagPrototyped | DIFlagStaticMember, spFlags: 0)
But instead of that, if we’re going to support using DW_AT_unspecified_type for auto and emitting declarations of auto functions even if there’s no definition available (which, again, I don’t think is super important/necessary by any means), the DWARF should look like this:
!7 = distinct !DISubprogram(name: “f1”, linkageName: “_ZN3foo2f1Ev”, scope: !8, file: !1, line: 4, type: !9, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !12, retainedNodes: !2)
!8 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: “foo”, file: !1, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !13, identifier: “_ZTS3foo”)
!9 = !DISubroutineType(types: !10)
!10 = !{!11}
!11 = !DIBasicType(name: “int”, size: 32, encoding: DW_ATE_signed)
!12 = !DISubprogram(name: “f1”, linkageName: “_ZN3foo2f1Ev”, scope: !8, file: !1, line: 2, type: !14, scopeLine: 2, flags: DIFlagPrototyped | DIFlagStaticMember, spFlags: 0)
!13 = !{!12}
!14 = !DISubroutineType(types: !15)
!15 = {!16}
!16 = DIBasicType(tag: DW_TAG_unspecified_type, name: “auto”)