• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc %s -o - | FileCheck %s
2
3; This test case caused UDTs to be discovered during UDT emission, which can
4; cause iterator invalidation.
5
6; Based on this C++:
7; typedef int a;
8; struct b;
9; class c {
10;   c();
11;   a b::*d;
12; };
13; c::c() = default;
14
15; Previously there was an issue were the "a" typedef would be emitted twice.
16; Check that there are only two typedefs, a and c.
17; CHECK:        .short  4360        # Record kind: S_UDT
18; CHECK:        .long   {{.*}}      # Type
19; CHECK:        .asciz  "a"
20; CHECK:        .p2align        2
21; CHECK:        .short  4360        # Record kind: S_UDT
22; CHECK:        .long   {{.*}}      # Type
23; CHECK:        .asciz  "c"
24; CHECK:        .p2align        2
25;   No other S_UDTs.
26; CHECK-NOT: S_UDT
27; CHECK:        .cv_filechecksums
28
29
30; ModuleID = 't.cpp'
31source_filename = "t.cpp"
32target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
33target triple = "x86_64-pc-windows-msvc19.16.0"
34
35%class.c = type { { i32, i32, i32 } }
36
37; Function Attrs: noinline nounwind optnone
38define dso_local %class.c* @"??0c@@AEAA@XZ"(%class.c* returned %this) unnamed_addr #0 align 2 !dbg !7 {
39entry:
40  %this.addr = alloca %class.c*, align 8
41  store %class.c* %this, %class.c** %this.addr, align 8
42  call void @llvm.dbg.declare(metadata %class.c** %this.addr, metadata !20, metadata !DIExpression()), !dbg !22
43  %this1 = load %class.c*, %class.c** %this.addr, align 8
44  ret %class.c* %this1, !dbg !23
45}
46
47; Function Attrs: nounwind readnone speculatable willreturn
48declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
49
50attributes #0 = { noinline nounwind optnone }
51attributes #1 = { nounwind readnone speculatable willreturn }
52
53!llvm.dbg.cu = !{!0}
54!llvm.module.flags = !{!3, !4, !5}
55!llvm.ident = !{!6}
56
57!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
58!1 = !DIFile(filename: "<stdin>", directory: "C:/src/llvm-project/build", checksumkind: CSK_MD5, checksum: "4cbca1b19718cc292886f5df0b72cf37")
59!2 = !{}
60!3 = !{i32 2, !"CodeView", i32 1}
61!4 = !{i32 2, !"Debug Info Version", i32 3}
62!5 = !{i32 1, !"wchar_size", i32 2}
63!6 = !{!"clang version 11.0.0 "}
64!7 = distinct !DISubprogram(name: "c", linkageName: "??0c@@AEAA@XZ", scope: !9, file: !8, line: 7, type: !17, scopeLine: 7, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !16, retainedNodes: !2)
65!8 = !DIFile(filename: "t.cpp", directory: "C:/src/llvm-project/build", checksumkind: CSK_MD5, checksum: "4cbca1b19718cc292886f5df0b72cf37")
66!9 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "c", file: !8, line: 3, size: 96, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !10, identifier: ".?AVc@@")
67!10 = !{!11, !16}
68!11 = !DIDerivedType(tag: DW_TAG_member, name: "d", scope: !9, file: !8, line: 5, baseType: !12, size: 96)
69!12 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !13, size: 96, extraData: !15)
70!13 = !DIDerivedType(tag: DW_TAG_typedef, name: "a", file: !8, line: 1, baseType: !14)
71!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
72!15 = !DICompositeType(tag: DW_TAG_structure_type, name: "b", file: !8, line: 2, flags: DIFlagFwdDecl | DIFlagNonTrivial, identifier: ".?AUb@@")
73!16 = !DISubprogram(name: "c", scope: !9, file: !8, line: 4, type: !17, scopeLine: 4, flags: DIFlagPrototyped, spFlags: 0)
74!17 = !DISubroutineType(types: !18)
75!18 = !{null, !19}
76!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
77!20 = !DILocalVariable(name: "this", arg: 1, scope: !7, type: !21, flags: DIFlagArtificial | DIFlagObjectPointer)
78!21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64)
79!22 = !DILocation(line: 0, scope: !7)
80!23 = !DILocation(line: 7, scope: !7)
81