summaryrefslogtreecommitdiff
path: root/test/lit/source-map.wast
blob: fe534043bd357024cc27d1e11bc5c187380fe080 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.

;; RUN: wasm-opt %s -o %t.wasm -osm %t.map -g -q
;; RUN: wasm-opt %t.wasm -ism %t.map -q -o - -S | filecheck %s

;; Also test with StackIR, which should have identical results.
;;
;; RUN: wasm-opt %s --generate-stack-ir -o %t.wasm -osm %t.map -g -q
;; RUN: wasm-opt %t.wasm -ism %t.map -q -o - -S | filecheck %s

(module
  ;;@ src.cpp:0:1
  ;; CHECK:      (type $0 (func))

  ;; CHECK:      (type $1 (func (param i32 i32)))

  ;; CHECK:      (func $foo (param $x i32) (param $y i32)
  ;; CHECK-NEXT:  ;;@ src.cpp:10:1
  ;; CHECK-NEXT:  (if
  ;; CHECK-NEXT:   ;;@ src.cpp:20:1
  ;; CHECK-NEXT:   (i32.add
  ;; CHECK-NEXT:    ;;@ src.cpp:30:1
  ;; CHECK-NEXT:    (local.get $x)
  ;; CHECK-NEXT:    ;;@ src.cpp:40:1
  ;; CHECK-NEXT:    (local.get $y)
  ;; CHECK-NEXT:   )
  ;; CHECK-NEXT:   (then
  ;; CHECK-NEXT:    ;;@ src.cpp:50:1
  ;; CHECK-NEXT:    (return)
  ;; CHECK-NEXT:   )
  ;; CHECK-NEXT:  )
  ;; CHECK-NEXT:  ;;@ src.cpp:60:1
  ;; CHECK-NEXT:  (call $foo
  ;; CHECK-NEXT:   ;;@ src.cpp:70:1
  ;; CHECK-NEXT:   (local.get $x)
  ;; CHECK-NEXT:   ;;@ src.cpp:80:1
  ;; CHECK-NEXT:   (local.get $y)
  ;; CHECK-NEXT:  )
  ;; CHECK-NEXT:  ;;@ src.cpp:90:1
  ;; CHECK-NEXT: )
  (func $foo (param $x i32) (param $y i32)
    ;;@ src.cpp:10:1
    (if
      ;;@ src.cpp:20:1
      (i32.add
        ;;@ src.cpp:30:1
        (local.get $x)
        ;;@ src.cpp:40:1
        (local.get $y)
      )
      (then
        ;;@ src.cpp:50:1
        (return)
      )
    )
    ;;@ src.cpp:60:1
    (call $foo
      ;;@ src.cpp:70:1
      (local.get $x)
      ;;@ src.cpp:80:1
      (local.get $y)
    )
    ;;@ src.cpp:90:1
  )

  ;; CHECK:      (func $nested-blocks
  ;; CHECK-NEXT:  ;;@ src.cpp:2:1
  ;; CHECK-NEXT:  (block
  ;; CHECK-NEXT:   ;;@ src.cpp:2:2
  ;; CHECK-NEXT:   (block $block
  ;; CHECK-NEXT:    (br $block)
  ;; CHECK-NEXT:   )
  ;; CHECK-NEXT:  )
  ;; CHECK-NEXT:  ;;@ src.cpp:3:1
  ;; CHECK-NEXT:  (return)
  ;; CHECK-NEXT: )
  (func $nested-blocks
    ;;@ src.cpp:2:1
    (block $label$1
      ;;@ src.cpp:2:2
      (block $label$2
        (br $label$2)
      )
    )
    ;;@ src.cpp:3:1
    (return)
  )

  ;; CHECK:      (func $paths
  ;; CHECK-NEXT:  ;;@ /tmp/src.cpp:1:1
  ;; CHECK-NEXT:  (nop)
  ;; CHECK-NEXT:  ;;@ ../src.cpp:2:2
  ;; CHECK-NEXT:  (nop)
  ;; CHECK-NEXT:  ;;@ café.cpp:2:2
  ;; CHECK-NEXT:  (nop)
  ;; CHECK-NEXT:  ;;@ café.cpp:2:2
  ;; CHECK-NEXT:  (nop)
  ;; CHECK-NEXT: )
  (func $paths
    ;;@ /tmp/src.cpp:1:1
    (nop)
    ;;@ ../src.cpp:2:2
    (nop)
    ;;@ café.cpp:2:2
    (nop)
    ;; This annotation is invalid (missing column)
    ;;@ 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)
  )
)