1; RUN: llc -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s
2
3; Generated by clang++ -S -c -std=c++11 --emit-llvm -g from the following C++11 source:
4;class foo {
5;[[noreturn]] void foo_member(){throw 1;}
6;};
7;
8;[[ noreturn ]] void f() {
9;    throw 1;
10;}
11;
12;void func(){
13;    foo object;
14;}
15
16; CHECK: DW_TAG_subprogram
17; CHECK-NOT: DW_TAG
18; CHECK: DW_AT_name{{.*}}"f"
19; CHECK-NOT: DW_TAG
20; CHECK: DW_AT_noreturn
21; CHECK: DW_TAG_class_type
22; CHECK: DW_TAG_subprogram
23; CHECK: DW_AT_name{{.*}}"foo_member"
24; CHECK: DW_AT_noreturn
25; ModuleID = 'test.cpp'
26
27source_filename = "noreturn1.cpp"
28target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
29target triple = "x86_64-unknown-linux-gnu"
30
31%class.foo = type { i8 }
32
33@_ZTIi = external dso_local constant i8*
34
35; Function Attrs: noinline noreturn optnone uwtable
36define dso_local void @_Z1fv() #0 !dbg !7 {
37  %1 = call i8* @__cxa_allocate_exception(i64 4) #3, !dbg !10
38  %2 = bitcast i8* %1 to i32*, !dbg !10
39  store i32 1, i32* %2, align 16, !dbg !10
40  call void @__cxa_throw(i8* %1, i8* bitcast (i8** @_ZTIi to i8*), i8* null) #4, !dbg !10
41  unreachable, !dbg !10
42}
43
44declare dso_local i8* @__cxa_allocate_exception(i64)
45
46declare dso_local void @__cxa_throw(i8*, i8*, i8*)
47
48; Function Attrs: noinline nounwind optnone uwtable
49define dso_local void @_Z4funcv() #1 !dbg !11 {
50  %1 = alloca %class.foo, align 1
51  call void @llvm.dbg.declare(metadata %class.foo* %1, metadata !12, metadata !DIExpression()), !dbg !19
52  ret void, !dbg !20
53}
54
55; Function Attrs: nounwind readnone speculatable willreturn
56declare void @llvm.dbg.declare(metadata, metadata, metadata) #2
57
58attributes #0 = { noinline noreturn optnone uwtable }
59attributes #1 = { noinline nounwind optnone uwtable }
60attributes #2 = { nounwind readnone speculatable willreturn }
61attributes #3 = { nounwind }
62attributes #4 = { noreturn }
63
64!llvm.dbg.cu = !{!0}
65!llvm.module.flags = !{!3, !4, !5}
66!llvm.ident = !{!6}
67
68!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_11, file: !1, producer: "clang version 10.0.0 (https://github.com/llvm/llvm-project.git 3fcdd25ad5566114ac3322dcbf71d3c38bfec1ed)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
69!1 = !DIFile(filename: "test.cpp", directory: "/home/sourabh/work/dwarf/c_c++/c++11")
70!2 = !{}
71!3 = !{i32 2, !"Dwarf Version", i32 4}
72!4 = !{i32 2, !"Debug Info Version", i32 3}
73!5 = !{i32 1, !"wchar_size", i32 4}
74!6 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 3fcdd25ad5566114ac3322dcbf71d3c38bfec1ed)"}
75!7 = distinct !DISubprogram(name: "f", linkageName: "_Z1fv", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped | DIFlagNoReturn, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
76!8 = !DISubroutineType(types: !9)
77!9 = !{null}
78!10 = !DILocation(line: 6, column: 5, scope: !7)
79!11 = distinct !DISubprogram(name: "func", linkageName: "_Z4funcv", scope: !1, file: !1, line: 9, type: !8, scopeLine: 9, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
80!12 = !DILocalVariable(name: "object", scope: !11, file: !1, line: 10, type: !13)
81!13 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo", file: !1, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !14, identifier: "_ZTS3foo")
82!14 = !{!15}
83!15 = !DISubprogram(name: "foo_member", linkageName: "_ZN3foo10foo_memberEv", scope: !13, file: !1, line: 2, type: !16, scopeLine: 2, flags: DIFlagPrototyped | DIFlagNoReturn, spFlags: 0)
84!16 = !DISubroutineType(types: !17)
85!17 = !{null, !18}
86!18 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
87!19 = !DILocation(line: 10, column: 9, scope: !11)
88!20 = !DILocation(line: 11, column: 1, scope: !11)
89