1; RUN: opt -verify < %s 2>&1 | FileCheck %s
2
3; CHECK: DIFlagAllCallsDescribed must be attached to a definition
4; CHECK: warning: ignoring invalid debug info
5
6; Source:
7;   struct A { ~A(); };
8;   void foo() { A x; }
9
10%struct.A = type { i8 }
11
12define void @_Z3foov() !dbg !8 {
13entry:
14  %x = alloca %struct.A, align 1
15  call void @llvm.dbg.declare(metadata %struct.A* %x, metadata !12, metadata !DIExpression()), !dbg !19
16  call void @_ZN1AD1Ev(%struct.A* %x) #3, !dbg !20
17  ret void, !dbg !20
18}
19
20declare void @llvm.dbg.declare(metadata, metadata, metadata)
21
22declare void @_ZN1AD1Ev(%struct.A*)
23
24!llvm.dbg.cu = !{!0}
25!llvm.module.flags = !{!3, !4, !5, !6}
26!llvm.ident = !{!7}
27
28!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 8.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
29!1 = !DIFile(filename: "-", directory: "/Users/vsk/src/builds/llvm-project-tailcall-RA")
30!2 = !{}
31!3 = !{i32 2, !"Dwarf Version", i32 4}
32!4 = !{i32 2, !"Debug Info Version", i32 3}
33!5 = !{i32 1, !"wchar_size", i32 4}
34!6 = !{i32 7, !"PIC Level", i32 2}
35!7 = !{!"clang version 8.0.0 "}
36!8 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !9, file: !9, line: 1, type: !10, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
37!9 = !DIFile(filename: "<stdin>", directory: "/Users/vsk/src/builds/llvm-project-tailcall-RA")
38!10 = !DISubroutineType(types: !11)
39!11 = !{null}
40!12 = !DILocalVariable(name: "x", scope: !8, file: !9, line: 1, type: !13)
41!13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !9, line: 1, size: 8, flags: DIFlagTypePassByReference, elements: !14, identifier: "_ZTS1A")
42!14 = !{!15}
43!15 = !DISubprogram(name: "~A", scope: !13, file: !9, line: 1, type: !16, isLocal: false, isDefinition: false, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, isOptimized: false)
44!16 = !DISubroutineType(types: !17)
45!17 = !{null, !18}
46!18 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
47!19 = !DILocation(line: 1, column: 36, scope: !8)
48!20 = !DILocation(line: 1, column: 39, scope: !8)
49