@@ -698,3 +698,56 @@ define void @class_field(ptr %arg1) !dbg !18 {
698
698
!10 = !{!8 }
699
699
700
700
!18 = distinct !DISubprogram (name: "SP" , scope: !3 , file: !2 , spFlags: DISPFlagDefinition, unit: !1 )
701
+
702
+ ; // -----
703
+
704
+ ; Ensures that replacing a nested mutually recursive decl does not result in
705
+ ; nested duplicate recursive decls.
706
+ ;
707
+ ; A ---> B <--> C
708
+ ; ^ ^
709
+ ; +-------------+
710
+
711
+ ; CHECK-DAG: #[[A:.+]] = #llvm.di_composite_type<{{.*}}recId = [[A_RECID:.+]], {{.*}}name = "A", {{.*}}elements = #[[A_TO_B:.+]], #[[A_TO_C:.+]]>
712
+ ; CHECK-DAG: #llvm.di_subprogram<{{.*}}scope = #[[A]],
713
+ ; CHECK-DAG: #[[A_TO_B]] = #llvm.di_derived_type<{{.*}}name = "->B", {{.*}}baseType = #[[B_FROM_A:.+]]>
714
+ ; CHECK-DAG: #[[A_TO_C]] = #llvm.di_derived_type<{{.*}}name = "->C", {{.*}}baseType = #[[C_FROM_A:.+]]>
715
+
716
+ ; CHECK-DAG: #[[B_FROM_A]] = #llvm.di_composite_type<{{.*}}recId = [[B_RECID:.+]], {{.*}}name = "B", {{.*}}elements = #[[B_TO_C:.+]]>
717
+ ; CHECK-DAG: #[[B_TO_C]] = #llvm.di_derived_type<{{.*}}name = "->C", {{.*}}baseType = #[[C_FROM_B:.+]]>
718
+ ; CHECK-DAG: #[[C_FROM_B]] = #llvm.di_composite_type<{{.*}}recId = [[C_RECID:.+]], {{.*}}name = "C", {{.*}}elements = #[[TO_A_SELF:.+]], #[[TO_B_SELF:.+]], #[[TO_C_SELF:.+]]>
719
+
720
+ ; CHECK-DAG: #[[C_FROM_A]] = #llvm.di_composite_type<{{.*}}recId = [[C_RECID]], {{.*}}name = "C", {{.*}}elements = #[[TO_A_SELF]], #[[TO_B_INNER:.+]], #[[TO_C_SELF]]
721
+ ; CHECK-DAG: #[[TO_B_INNER]] = #llvm.di_derived_type<{{.*}}name = "->B", {{.*}}baseType = #[[B_INNER:.+]]>
722
+ ; CHECK-DAG: #[[B_INNER]] = #llvm.di_composite_type<{{.*}}name = "B", {{.*}}elements = #[[TO_C_SELF]]>
723
+
724
+ ; CHECK-DAG: #[[TO_A_SELF]] = #llvm.di_derived_type<{{.*}}name = "->A", {{.*}}baseType = #[[A_SELF:.+]]>
725
+ ; CHECK-DAG: #[[TO_B_SELF]] = #llvm.di_derived_type<{{.*}}name = "->B", {{.*}}baseType = #[[B_SELF:.+]]>
726
+ ; CHECK-DAG: #[[TO_C_SELF]] = #llvm.di_derived_type<{{.*}}name = "->C", {{.*}}baseType = #[[C_SELF:.+]]>
727
+ ; CHECK-DAG: #[[A_SELF]] = #llvm.di_composite_type<{{.*}}recId = [[A_RECID]]>
728
+ ; CHECK-DAG: #[[B_SELF]] = #llvm.di_composite_type<{{.*}}recId = [[B_RECID]]>
729
+ ; CHECK-DAG: #[[C_SELF]] = #llvm.di_composite_type<{{.*}}recId = [[C_RECID]]>
730
+
731
+ define void @class_field (ptr %arg1 ) !dbg !18 {
732
+ ret void
733
+ }
734
+
735
+ !llvm.dbg.cu = !{!1 }
736
+ !llvm.module.flags = !{!0 }
737
+ !0 = !{i32 2 , !"Debug Info Version" , i32 3 }
738
+ !1 = distinct !DICompileUnit (language: DW_LANG_C, file: !2 )
739
+ !2 = !DIFile (filename: "debug-info.ll" , directory: "/" )
740
+
741
+ !3 = !DICompositeType (tag: DW_TAG_class_type, name: "A" , file: !2 , line: 42 , flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !9 )
742
+ !4 = !DICompositeType (tag: DW_TAG_class_type, name: "B" , file: !2 , line: 42 , flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !10 )
743
+ !5 = !DICompositeType (tag: DW_TAG_class_type, name: "C" , file: !2 , line: 42 , flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !11 )
744
+
745
+ !6 = !DIDerivedType (tag: DW_TAG_member, name: "->A" , file: !2 , baseType: !3 )
746
+ !7 = !DIDerivedType (tag: DW_TAG_member, name: "->B" , file: !2 , baseType: !4 )
747
+ !8 = !DIDerivedType (tag: DW_TAG_member, name: "->C" , file: !2 , baseType: !5 )
748
+
749
+ !9 = !{!7 , !8 } ; A -> B, C
750
+ !10 = !{!8 } ; B -> C
751
+ !11 = !{!6 , !7 , !8 } ; C -> A, B, C
752
+
753
+ !18 = distinct !DISubprogram (name: "SP" , scope: !3 , file: !2 , spFlags: DISPFlagDefinition, unit: !1 )
0 commit comments