xref: /llvm-project/llvm/test/DebugInfo/X86/noreturn_cpp11.ll (revision 5a288fa32e0c91b211e39f3e370255916902f898)
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 ptr
34
35; Function Attrs: noinline noreturn optnone uwtable
36define dso_local void @_Z1fv() #0 !dbg !7 {
37  %1 = call ptr @__cxa_allocate_exception(i64 4) #3, !dbg !10
38  store i32 1, ptr %1, align 16, !dbg !10
39  call void @__cxa_throw(ptr %1, ptr @_ZTIi, ptr null) #4, !dbg !10
40  unreachable, !dbg !10
41}
42
43declare dso_local ptr @__cxa_allocate_exception(i64)
44
45declare dso_local void @__cxa_throw(ptr, ptr, ptr)
46
47; Function Attrs: noinline nounwind optnone uwtable
48define dso_local void @_Z4funcv() #1 !dbg !11 {
49  %1 = alloca %class.foo, align 1
50  call void @llvm.dbg.declare(metadata ptr %1, metadata !12, metadata !DIExpression()), !dbg !19
51  ret void, !dbg !20
52}
53
54; Function Attrs: nounwind readnone speculatable willreturn
55declare void @llvm.dbg.declare(metadata, metadata, metadata) #2
56
57attributes #0 = { noinline noreturn optnone uwtable }
58attributes #1 = { noinline nounwind optnone uwtable }
59attributes #2 = { nounwind readnone speculatable willreturn }
60attributes #3 = { nounwind }
61attributes #4 = { noreturn }
62
63!llvm.dbg.cu = !{!0}
64!llvm.module.flags = !{!3, !4, !5}
65!llvm.ident = !{!6}
66
67!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)
68!1 = !DIFile(filename: "test.cpp", directory: "/home/sourabh/work/dwarf/c_c++/c++11")
69!2 = !{}
70!3 = !{i32 2, !"Dwarf Version", i32 4}
71!4 = !{i32 2, !"Debug Info Version", i32 3}
72!5 = !{i32 1, !"wchar_size", i32 4}
73!6 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 3fcdd25ad5566114ac3322dcbf71d3c38bfec1ed)"}
74!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)
75!8 = !DISubroutineType(types: !9)
76!9 = !{null}
77!10 = !DILocation(line: 6, column: 5, scope: !7)
78!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)
79!12 = !DILocalVariable(name: "object", scope: !11, file: !1, line: 10, type: !13)
80!13 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo", file: !1, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !14, identifier: "_ZTS3foo")
81!14 = !{!15}
82!15 = !DISubprogram(name: "foo_member", linkageName: "_ZN3foo10foo_memberEv", scope: !13, file: !1, line: 2, type: !16, scopeLine: 2, flags: DIFlagPrototyped | DIFlagNoReturn, spFlags: 0)
83!16 = !DISubroutineType(types: !17)
84!17 = !{null, !18}
85!18 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
86!19 = !DILocation(line: 10, column: 9, scope: !11)
87!20 = !DILocation(line: 11, column: 1, scope: !11)
88