diff options
| author | Matt Davis <Matthew.Davis@sony.com> | 2018-03-08 19:31:37 +0000 |
|---|---|---|
| committer | Matt Davis <Matthew.Davis@sony.com> | 2018-03-08 19:31:37 +0000 |
| commit | 50472279d48779748da286cfc2dfc0da7072f4f6 (patch) | |
| tree | ba30a38bc56f03ab210f8a6e127c0df4f11c5342 /llvm/test/Verifier/dbg-invalid-vector.ll | |
| parent | f6337d3a7334992d8edb5672956dc73bfb56f69f (diff) | |
| download | bcm5719-llvm-50472279d48779748da286cfc2dfc0da7072f4f6.tar.gz bcm5719-llvm-50472279d48779748da286cfc2dfc0da7072f4f6.zip | |
[DebugInfo] Add verifier for DICompositeType vector
Summary:
This patch adds verification logic for DICompositeType vectors, ensuring that they only have one element, and that element is of type subrange.
This patch complements https://reviews.llvm.org/D44048
Reviewers: aprantl
Reviewed By: aprantl
Subscribers: JDevlieghere, llvm-commits
Tags: #debug-info
Differential Revision: https://reviews.llvm.org/D44262
llvm-svn: 327048
Diffstat (limited to 'llvm/test/Verifier/dbg-invalid-vector.ll')
| -rw-r--r-- | llvm/test/Verifier/dbg-invalid-vector.ll | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/test/Verifier/dbg-invalid-vector.ll b/llvm/test/Verifier/dbg-invalid-vector.ll new file mode 100644 index 00000000000..d33d20dfb1c --- /dev/null +++ b/llvm/test/Verifier/dbg-invalid-vector.ll @@ -0,0 +1,36 @@ +; RUN: opt -verify -disable-output <%s 2>&1 | FileCheck %s +; +; This test creates an invalid vector by defining multiple elements for the +; vector's DICompositeType definition. A vector should only have one element +; in its DICompositeType 'elements' array. +; +; CHECK: invalid vector + +@f.foo = private unnamed_addr constant <6 x float> zeroinitializer, align 32 + +define void @f() { + %1 = alloca <6 x float>, align 32 + call void @llvm.dbg.declare(metadata <6 x float>* %1, metadata !10, metadata !DIExpression()), !dbg !18 + ret void +} + +declare void @llvm.dbg.declare(metadata, metadata, metadata) + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) +!1 = !DIFile(filename: "test.c", directory: "/dbg/info") +!2 = !{} +!3 = !{i32 2, !"Dwarf Version", i32 4} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2) +!8 = !DISubroutineType(types: !9) +!9 = !{null} +!10 = !DILocalVariable(name: "foo", scope: !7, file: !1, line: 4, type: !12) +!12 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, size: 256, flags: DIFlagVector, elements: !14) +!13 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float) +!14 = !{!15, !19} +!15 = !DISubrange(count: 6) +!18 = !DILocation(line: 4, column: 48, scope: !7) +!19 = !DISubrange(count: 42) |

