Fix #7289: Add debug info module flags as-needed and verify if already present (#7336)

This avoids duplicate module flags when compiling C++ interop with debug
info.

Assisted-by: Gemini via Antigravity
This commit is contained in:
David Blaikie
2026-06-16 03:18:05 +00:00
committed by GitHub
parent d13495771a
commit 88b3605eac
239 changed files with 3975 additions and 3888 deletions
+10 -10
View File
@@ -71,14 +71,14 @@ fn DoubleULong64(ul64: Core.CppCompat.ULongLong64) -> u64 {
// CHECK:STDOUT:
// CHECK:STDOUT: attributes #0 = { nounwind }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT: !llvm.dbg.cu = !{!0}
// CHECK:STDOUT: !llvm.module.flags = !{!2, !3}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "primitives.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "DoubleLong32", linkageName: "_CDoubleLong32.Main", scope: null, file: !3, line: 5, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !8)
// CHECK:STDOUT: !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !1 = !DIFile(filename: "primitives.carbon", directory: "")
// CHECK:STDOUT: !2 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !3 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "DoubleLong32", linkageName: "_CDoubleLong32.Main", scope: null, file: !1, line: 5, type: !5, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !8)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{!7, !7}
// CHECK:STDOUT: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
@@ -86,7 +86,7 @@ fn DoubleULong64(ul64: Core.CppCompat.ULongLong64) -> u64 {
// CHECK:STDOUT: !9 = !DILocalVariable(arg: 1, scope: !4, type: !7)
// CHECK:STDOUT: !10 = !DILocation(line: 7, column: 10, scope: !4)
// CHECK:STDOUT: !11 = !DILocation(line: 7, column: 3, scope: !4)
// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "DoubleULong32", linkageName: "_CDoubleULong32.Main", scope: null, file: !3, line: 11, type: !13, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !16)
// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "DoubleULong32", linkageName: "_CDoubleULong32.Main", scope: null, file: !1, line: 11, type: !13, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !16)
// CHECK:STDOUT: !13 = !DISubroutineType(types: !14)
// CHECK:STDOUT: !14 = !{!15, !15}
// CHECK:STDOUT: !15 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_unsigned)
@@ -94,7 +94,7 @@ fn DoubleULong64(ul64: Core.CppCompat.ULongLong64) -> u64 {
// CHECK:STDOUT: !17 = !DILocalVariable(arg: 1, scope: !12, type: !15)
// CHECK:STDOUT: !18 = !DILocation(line: 13, column: 10, scope: !12)
// CHECK:STDOUT: !19 = !DILocation(line: 13, column: 3, scope: !12)
// CHECK:STDOUT: !20 = distinct !DISubprogram(name: "DoubleLongLong64", linkageName: "_CDoubleLongLong64.Main", scope: null, file: !3, line: 17, type: !21, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !24)
// CHECK:STDOUT: !20 = distinct !DISubprogram(name: "DoubleLongLong64", linkageName: "_CDoubleLongLong64.Main", scope: null, file: !1, line: 17, type: !21, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !24)
// CHECK:STDOUT: !21 = !DISubroutineType(types: !22)
// CHECK:STDOUT: !22 = !{!23, !23}
// CHECK:STDOUT: !23 = !DIBasicType(name: "int", size: 64, encoding: DW_ATE_signed)
@@ -102,7 +102,7 @@ fn DoubleULong64(ul64: Core.CppCompat.ULongLong64) -> u64 {
// CHECK:STDOUT: !25 = !DILocalVariable(arg: 1, scope: !20, type: !23)
// CHECK:STDOUT: !26 = !DILocation(line: 19, column: 10, scope: !20)
// CHECK:STDOUT: !27 = !DILocation(line: 19, column: 3, scope: !20)
// CHECK:STDOUT: !28 = distinct !DISubprogram(name: "DoubleULong64", linkageName: "_CDoubleULong64.Main", scope: null, file: !3, line: 23, type: !29, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !32)
// CHECK:STDOUT: !28 = distinct !DISubprogram(name: "DoubleULong64", linkageName: "_CDoubleULong64.Main", scope: null, file: !1, line: 23, type: !29, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !32)
// CHECK:STDOUT: !29 = !DISubroutineType(types: !30)
// CHECK:STDOUT: !30 = !{!31, !31}
// CHECK:STDOUT: !31 = !DIBasicType(name: "int", size: 64, encoding: DW_ATE_unsigned)