summaryrefslogtreecommitdiffstats
path: root/llvm/test/DebugInfo/COFF
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-07-28 05:03:22 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-07-28 05:03:22 +0000
commit67f684e18ea55621078b30ab26462f7e74e0986a (patch)
tree840f5266c699491106d5ee1d643270785829a4ab /llvm/test/DebugInfo/COFF
parentaa849bc2f23432af3104b2c1524009312bcad223 (diff)
downloadbcm5719-llvm-67f684e18ea55621078b30ab26462f7e74e0986a.tar.gz
bcm5719-llvm-67f684e18ea55621078b30ab26462f7e74e0986a.zip
[CodeView] Don't crash on functions without subprograms
A function may have instructions annotated with debug info without having a subprogram. This fixes PR28747. llvm-svn: 276956
Diffstat (limited to 'llvm/test/DebugInfo/COFF')
-rw-r--r--llvm/test/DebugInfo/COFF/inlining-same-name.ll2
-rw-r--r--llvm/test/DebugInfo/COFF/pr28747.ll44
2 files changed, 45 insertions, 1 deletions
diff --git a/llvm/test/DebugInfo/COFF/inlining-same-name.ll b/llvm/test/DebugInfo/COFF/inlining-same-name.ll
index 44b87912f80..fda5a6dc6ff 100644
--- a/llvm/test/DebugInfo/COFF/inlining-same-name.ll
+++ b/llvm/test/DebugInfo/COFF/inlining-same-name.ll
@@ -33,7 +33,7 @@
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
-define void @main(i32* %i.i) {
+define void @main(i32* %i.i) !dbg !16 {
store volatile i32 3, i32* %i.i, !dbg !6
store volatile i32 3, i32* %i.i, !dbg !19
ret void
diff --git a/llvm/test/DebugInfo/COFF/pr28747.ll b/llvm/test/DebugInfo/COFF/pr28747.ll
new file mode 100644
index 00000000000..d19a2fae682
--- /dev/null
+++ b/llvm/test/DebugInfo/COFF/pr28747.ll
@@ -0,0 +1,44 @@
+; RUN: llc < %s | FileCheck %s
+
+; CHECK: .section .debug$S,"dr"{{$}}
+; CHECK-NEXT: .p2align 2
+; CHECK-NEXT: .long 4
+; CHECK-NEXT: .cv_filechecksums
+; CHECK-NEXT: .cv_stringtable
+
+target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
+target triple = "i686-pc-windows-msvc18.0.0"
+
+define void @baz() {
+entry:
+ %x.i.i = alloca i32, align 4
+ call void @llvm.dbg.declare(metadata i32* %x.i.i, metadata !6, metadata !12), !dbg !13
+ store i32 5, i32* %x.i.i, align 4, !dbg !13
+ ret void
+}
+
+; Function Attrs: nounwind readnone
+declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
+
+attributes #0 = { nounwind readnone }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4}
+!llvm.ident = !{!5}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0 (trunk 276756) (llvm/trunk 276952)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
+!1 = !DIFile(filename: "-", directory: "/")
+!2 = !{}
+!3 = !{i32 2, !"CodeView", i32 1}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!5 = !{!"clang version 4.0.0 (trunk 276756) (llvm/trunk 276952)"}
+!6 = !DILocalVariable(name: "x", scope: !7, file: !8, line: 1, type: !11)
+!7 = distinct !DISubprogram(name: "foo", scope: !8, file: !8, line: 1, type: !9, isLocal: true, isDefinition: true, scopeLine: 1, isOptimized: false, unit: !0, variables: !2)
+!8 = !DIFile(filename: "<stdin>", directory: "/")
+!9 = !DISubroutineType(types: !10)
+!10 = !{null}
+!11 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
+!12 = !DIExpression()
+!13 = !DILocation(line: 1, column: 56, scope: !7, inlinedAt: !14)
+!14 = distinct !DILocation(line: 2, column: 52, scope: !15)
+!15 = distinct !DISubprogram(name: "bar", scope: !8, file: !8, line: 2, type: !9, isLocal: true, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0, variables: !2)
OpenPOWER on IntegriCloud