This repository has been archived by the owner on Mar 20, 2024. It is now read-only.
forked from move-language/move
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...v-llvm-compiler/tests/dwarf-tests/dwarf-vector-build/0x101__vector.ll.debug_info.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
; ModuleID = '0x101__vector.dbg_info' | ||
source_filename = "/language/tools/move-mv-llvm-compiler/tests/dwarf-tests/dwarf-vector.move" | ||
|
||
!llvm.dbg.cu = !{!0} | ||
!unspecified\20type = !{!2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2} | ||
!struct.vector__Foo = !{!6} | ||
!struct.vector__Bar = !{!14} | ||
!test_singleton_contains = !{!19} | ||
!singleton = !{!23, !28} | ||
|
||
!0 = distinct !DICompileUnit(language: DW_LANG_Rust, file: !1, producer: "move-mv-llvm-compiler", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") | ||
!1 = !DIFile(filename: "dwarf-vector.move", directory: "/language/tools/move-mv-llvm-compiler/tests/dwarf-tests") | ||
!2 = !DICompositeType(tag: DW_TAG_array_type, baseType: !3, size: 192, align: 8, flags: DIFlagVector, elements: !4) | ||
!3 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "unspecified type") | ||
!4 = !{!5} | ||
!5 = !DISubrange(count: 1, lowerBound: 0) | ||
!6 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "struct.vector__Foo__ptr", baseType: !7, size: 64, align: 64, dwarfAddressSpace: 0) | ||
!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "struct.vector__Foo", scope: !8, file: !1, line: 2, size: 128, align: 8, flags: DIFlagObjcClassComplete, elements: !9) | ||
!8 = !DINamespace(name: "struct.vector__Foo", scope: !1) | ||
!9 = !{!10, !12} | ||
!10 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !8, file: !1, line: 2, baseType: !11, size: 64, align: 64) | ||
!11 = !DIBasicType(name: "u64", size: 64) | ||
!12 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !8, file: !1, line: 3, baseType: !13, size: 1, align: 8, offset: 64) | ||
!13 = !DIBasicType(name: "bool", size: 8) | ||
!14 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "struct.vector__Bar__ptr", baseType: !15, size: 64, align: 64, dwarfAddressSpace: 0) | ||
!15 = !DICompositeType(tag: DW_TAG_structure_type, name: "struct.vector__Bar", scope: !16, file: !1, line: 3, size: 128, align: 8, flags: DIFlagObjcClassComplete, elements: !17) | ||
!16 = !DINamespace(name: "struct.vector__Bar", scope: !1) | ||
!17 = !{!18} | ||
!18 = !DIDerivedType(tag: DW_TAG_member, name: "foo", scope: !16, file: !1, line: 3, baseType: !7, size: 128, align: 64) | ||
!19 = distinct !DISubprogram(name: "test_singleton_contains", linkageName: "test_singleton_contains", scope: !20, file: !1, line: 17, type: !21, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !22) | ||
!20 = !DINamespace(name: "test_singleton_contains", scope: !1) | ||
!21 = !DISubroutineType(types: !22) | ||
!22 = !{} | ||
!23 = distinct !DISubprogram(name: "singleton", linkageName: "singleton", scope: !24, file: !1, line: 11, type: !25, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !22) | ||
!24 = !DINamespace(name: "singleton", scope: !1) | ||
!25 = !DISubroutineType(types: !26) | ||
!26 = !{!27} | ||
!27 = !DILocalVariable(name: "e", scope: !24, file: !1, type: !7) | ||
!28 = distinct !DISubprogram(name: "singleton", linkageName: "singleton", scope: !24, file: !1, line: 11, type: !29, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !22) | ||
!29 = !DISubroutineType(types: !30) | ||
!30 = !{!31} | ||
!31 = !DILocalVariable(name: "e", scope: !24, file: !1, type: !15) |
25 changes: 25 additions & 0 deletions
25
language/tools/move-mv-llvm-compiler/tests/dwarf-tests/dwarf-vector.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module 0x101::vector { | ||
|
||
struct Foo has copy, drop { x: u64, y: bool } | ||
struct Bar has copy, drop { foo: Foo } | ||
|
||
native public fun empty<Element>(): vector<Element>; | ||
|
||
native public fun borrow<Element>(v: &vector<Element>, i: u64): ∈ | ||
|
||
native public fun push_back<Element>(v: &mut vector<Element>, e: Element); | ||
|
||
public fun singleton<Element>(e: Element): vector<Element> { | ||
let v = empty(); | ||
push_back(&mut v, e); | ||
v | ||
} | ||
|
||
public fun test_singleton_contains() { | ||
let foo1 = Foo { x: 0, y: false }; | ||
assert!(*borrow(&singleton(foo1), 0) == foo1, 0); | ||
|
||
let bar1 = Bar { foo: foo1 }; | ||
assert!(*borrow(&singleton(bar1), 0) == bar1, 0); | ||
} | ||
} |