diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2024-10-01 23:39:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-01 14:39:34 -0700 |
commit | 347fc8a57dcfd9361b05f271a7f2badc929500cf (patch) | |
tree | 362a40ae7bc9bcb9e8c40967505d3414691f6af6 /test | |
parent | cb53f0c6966fe7c8e5cc1a975eab9653b5914bde (diff) | |
download | binaryen-347fc8a57dcfd9361b05f271a7f2badc929500cf.tar.gz binaryen-347fc8a57dcfd9361b05f271a7f2badc929500cf.tar.bz2 binaryen-347fc8a57dcfd9361b05f271a7f2badc929500cf.zip |
Source Maps: Support 5 segment mappings (#6795)
Support 5-segment source mappings, which add a name.
Reference:
https://github.com/tc39/source-map/blob/main/source-map-rev3.md#proposed-format
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/merge/sourcemap.wat | 22 | ||||
-rw-r--r-- | test/lit/merge/sourcemap.wat.second | 6 | ||||
-rw-r--r-- | test/lit/metadce/sourcemap.wat | 14 | ||||
-rw-r--r-- | test/lit/passes/inlining_source-maps.wast | 36 | ||||
-rw-r--r-- | test/lit/source-map.wast | 17 |
5 files changed, 74 insertions, 21 deletions
diff --git a/test/lit/merge/sourcemap.wat b/test/lit/merge/sourcemap.wat index 8ccb37399..1eec0bcbe 100644 --- a/test/lit/merge/sourcemap.wat +++ b/test/lit/merge/sourcemap.wat @@ -9,11 +9,11 @@ ;; Test that sourcemap information is preserved (module - ;;@ a:1:1 + ;;@ a:1:2 (func (export "f") - ;;@ a:2:1 + ;;@ a:3:4:myFunction (nop) - ;;@ a:3:1 + ;;@ a:5:6 ) ) ;; CHECK-TEXT: (type $0 (func)) @@ -23,15 +23,15 @@ ;; CHECK-TEXT: (export "g" (func $0_1)) ;; CHECK-TEXT: (func $0 -;; CHECK-TEXT-NEXT: ;;@ a:2:1 +;; CHECK-TEXT-NEXT: ;;@ a:3:4:myFunction ;; CHECK-TEXT-NEXT: (nop) -;; CHECK-TEXT-NEXT: ;;@ a:3:1 +;; CHECK-TEXT-NEXT: ;;@ a:5:6 ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT: (func $0_1 -;; CHECK-TEXT-NEXT: ;;@ b:2:2 +;; CHECK-TEXT-NEXT: ;;@ b:9:10:MyClass::g ;; CHECK-TEXT-NEXT: (nop) -;; CHECK-TEXT-NEXT: ;;@ b:3:2 +;; CHECK-TEXT-NEXT: ;;@ b:11:12 ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (type $0 (func)) @@ -41,13 +41,13 @@ ;; CHECK-BIN: (export "g" (func $1)) ;; CHECK-BIN: (func $0 -;; CHECK-BIN-NEXT: ;;@ a:2:1 +;; CHECK-BIN-NEXT: ;;@ a:3:4:myFunction ;; CHECK-BIN-NEXT: (nop) -;; CHECK-BIN-NEXT: ;;@ a:3:1 +;; CHECK-BIN-NEXT: ;;@ a:5:6 ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN: (func $1 -;; CHECK-BIN-NEXT: ;;@ b:2:2 +;; CHECK-BIN-NEXT: ;;@ b:9:10:MyClass::g ;; CHECK-BIN-NEXT: (nop) -;; CHECK-BIN-NEXT: ;;@ b:3:2 +;; CHECK-BIN-NEXT: ;;@ b:11:12 ;; CHECK-BIN-NEXT: ) diff --git a/test/lit/merge/sourcemap.wat.second b/test/lit/merge/sourcemap.wat.second index 0ea7c75fa..3f1c110da 100644 --- a/test/lit/merge/sourcemap.wat.second +++ b/test/lit/merge/sourcemap.wat.second @@ -1,8 +1,8 @@ (module - ;;@ b:1:2 + ;;@ b:7:8 (func (export "g") - ;;@ b:2:2 + ;;@ b:9:10:MyClass::g (nop) - ;;@ b:3:2 + ;;@ b:11:12 ) ) diff --git a/test/lit/metadce/sourcemap.wat b/test/lit/metadce/sourcemap.wat index 8a73a01da..0190fe557 100644 --- a/test/lit/metadce/sourcemap.wat +++ b/test/lit/metadce/sourcemap.wat @@ -7,20 +7,20 @@ ;; Test that sourcemap information is preserved (module - ;;@ a:1:1 + ;;@ a:1:2 ;; TXT: (type $0 (func)) ;; TXT: (export "f" (func $f)) ;; TXT: (func $f - ;; TXT-NEXT: ;;@ a:2:1 + ;; TXT-NEXT: ;;@ a:7:8:someSymbol ;; TXT-NEXT: (nop) - ;; TXT-NEXT: ;;@ a:3:1 + ;; TXT-NEXT: ;;@ a:9:10 ;; TXT-NEXT: ) (func $f (export "f") - ;;@ a:2:1 + ;;@ a:7:8:someSymbol (nop) - ;;@ a:3:1 + ;;@ a:9:10 ) ) ;; BIN: (type $0 (func)) @@ -28,7 +28,7 @@ ;; BIN: (export "f" (func $0)) ;; BIN: (func $0 -;; BIN-NEXT: ;;@ a:2:1 +;; BIN-NEXT: ;;@ a:7:8:someSymbol ;; BIN-NEXT: (nop) -;; BIN-NEXT: ;;@ a:3:1 +;; BIN-NEXT: ;;@ a:9:10 ;; BIN-NEXT: ) diff --git a/test/lit/passes/inlining_source-maps.wast b/test/lit/passes/inlining_source-maps.wast new file mode 100644 index 000000000..5b5549986 --- /dev/null +++ b/test/lit/passes/inlining_source-maps.wast @@ -0,0 +1,36 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. + +;; RUN: foreach %s %t wasm-opt --inlining --all-features -S -o - | filecheck %s + +(module + ;; CHECK: (type $0 (func)) + + ;; CHECK: (start $2) + (start $2) + + (func $0 + ;;@ foo.cpp:1:2 + (nop) + ) + + (func $1 + ;;@ bar.cpp:3:4:MyFunction + (nop) + ) + + ;; CHECK: (func $2 (type $0) + ;; CHECK-NEXT: (block $__inlined_func$0 + ;; CHECK-NEXT: ;;@ foo.cpp:1:2 + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ;;@ + ;; CHECK-NEXT: (block $__inlined_func$1$1 + ;; CHECK-NEXT: ;;@ bar.cpp:3:4:MyFunction + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $2 + (call $0) + (call $1) + ) +) diff --git a/test/lit/source-map.wast b/test/lit/source-map.wast index f8ef07c65..b4fc55374 100644 --- a/test/lit/source-map.wast +++ b/test/lit/source-map.wast @@ -110,4 +110,21 @@ ;;@ src.cpp:3 (nop) ) + + ;; CHECK: (func $symbolNames + ;; CHECK-NEXT: ;;@ /tmp/src.cpp:1:2:MyClass.myMethod + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ;;@ ../src.cpp:3:4:MyClass::myMethod + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ;;@ café.cpp:5:6:topLevelFunction + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + (func $symbolNames + ;;@ /tmp/src.cpp:1:2:MyClass.myMethod + (nop) + ;;@ ../src.cpp:3:4:MyClass::myMethod + (nop) + ;;@ café.cpp:5:6:topLevelFunction + (nop) + ) ) |