summaryrefslogtreecommitdiffstats
path: root/third_party/wasm2c/src/binary-reader-nop.h
blob: f22b05ad5b5c91fbdbb47429990c263d30088674 (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
/*
 * Copyright 2016 WebAssembly Community Group participants
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef WABT_BINARY_READER_NOP_H_
#define WABT_BINARY_READER_NOP_H_

#include "src/binary-reader.h"

namespace wabt {

class BinaryReaderNop : public BinaryReaderDelegate {
 public:
  bool OnError(const Error&) override { return false; }

  /* Module */
  Result BeginModule(uint32_t version) override { return Result::Ok; }
  Result EndModule() override { return Result::Ok; }

  Result BeginSection(Index section_index,
                      BinarySection section_type,
                      Offset size) override {
    return Result::Ok;
  }

  /* Custom section */
  Result BeginCustomSection(Index section_index,
                            Offset size,
                            string_view section_name) override {
    return Result::Ok;
  }
  Result EndCustomSection() override { return Result::Ok; }

  /* Type section */
  Result BeginTypeSection(Offset size) override { return Result::Ok; }
  Result OnTypeCount(Index count) override { return Result::Ok; }
  Result OnFuncType(Index index,
                    Index param_count,
                    Type* param_types,
                    Index result_count,
                    Type* result_types) override {
    return Result::Ok;
  }
  Result OnStructType(Index index,
                      Index field_count,
                      TypeMut* fields) override {
    return Result::Ok;
  }
  Result OnArrayType(Index index, TypeMut field) override {
    return Result::Ok;
  }
  Result EndTypeSection() override { return Result::Ok; }

  /* Import section */
  Result BeginImportSection(Offset size) override { return Result::Ok; }
  Result OnImportCount(Index count) override { return Result::Ok; }
  Result OnImport(Index index,
                  ExternalKind kind,
                  string_view module_name,
                  string_view field_name) override {
    return Result::Ok;
  }
  Result OnImportFunc(Index import_index,
                      string_view module_name,
                      string_view field_name,
                      Index func_index,
                      Index sig_index) override {
    return Result::Ok;
  }
  Result OnImportTable(Index import_index,
                       string_view module_name,
                       string_view field_name,
                       Index table_index,
                       Type elem_type,
                       const Limits* elem_limits) override {
    return Result::Ok;
  }
  Result OnImportMemory(Index import_index,
                        string_view module_name,
                        string_view field_name,
                        Index memory_index,
                        const Limits* page_limits) override {
    return Result::Ok;
  }
  Result OnImportGlobal(Index import_index,
                        string_view module_name,
                        string_view field_name,
                        Index global_index,
                        Type type,
                        bool mutable_) override {
    return Result::Ok;
  }
  Result OnImportTag(Index import_index,
                     string_view module_name,
                     string_view field_name,
                     Index tag_index,
                     Index sig_index) override {
    return Result::Ok;
  }
  Result EndImportSection() override { return Result::Ok; }

  /* Function section */
  Result BeginFunctionSection(Offset size) override { return Result::Ok; }
  Result OnFunctionCount(Index count) override { return Result::Ok; }
  Result OnFunction(Index index, Index sig_index) override {
    return Result::Ok;
  }
  Result EndFunctionSection() override { return Result::Ok; }

  /* Table section */
  Result BeginTableSection(Offset size) override { return Result::Ok; }
  Result OnTableCount(Index count) override { return Result::Ok; }
  Result OnTable(Index index,
                 Type elem_type,
                 const Limits* elem_limits) override {
    return Result::Ok;
  }
  Result EndTableSection() override { return Result::Ok; }

  /* Memory section */
  Result BeginMemorySection(Offset size) override { return Result::Ok; }
  Result OnMemoryCount(Index count) override { return Result::Ok; }
  Result OnMemory(Index index, const Limits* limits) override {
    return Result::Ok;
  }
  Result EndMemorySection() override { return Result::Ok; }

  /* Global section */
  Result BeginGlobalSection(Offset size) override { return Result::Ok; }
  Result OnGlobalCount(Index count) override { return Result::Ok; }
  Result BeginGlobal(Index index, Type type, bool mutable_) override {
    return Result::Ok;
  }
  Result BeginGlobalInitExpr(Index index) override { return Result::Ok; }
  Result EndGlobalInitExpr(Index index) override { return Result::Ok; }
  Result EndGlobal(Index index) override { return Result::Ok; }
  Result EndGlobalSection() override { return Result::Ok; }

  /* Exports section */
  Result BeginExportSection(Offset size) override { return Result::Ok; }
  Result OnExportCount(Index count) override { return Result::Ok; }
  Result OnExport(Index index,
                  ExternalKind kind,
                  Index item_index,
                  string_view name) override {
    return Result::Ok;
  }
  Result EndExportSection() override { return Result::Ok; }

  /* Start section */
  Result BeginStartSection(Offset size) override { return Result::Ok; }
  Result OnStartFunction(Index func_index) override { return Result::Ok; }
  Result EndStartSection() override { return Result::Ok; }

  /* Code section */
  Result BeginCodeSection(Offset size) override { return Result::Ok; }
  Result OnFunctionBodyCount(Index count) override { return Result::Ok; }
  Result BeginFunctionBody(Index index, Offset size) override {
    return Result::Ok;
  }
  Result OnLocalDeclCount(Index count) override { return Result::Ok; }
  Result OnLocalDecl(Index decl_index, Index count, Type type) override {
    return Result::Ok;
  }

  /* Function expressions; called between BeginFunctionBody and
   EndFunctionBody */
  Result OnOpcode(Opcode Opcode) override { return Result::Ok; }
  Result OnOpcodeBare() override { return Result::Ok; }
  Result OnOpcodeIndex(Index value) override { return Result::Ok; }
  Result OnOpcodeIndexIndex(Index value, Index value2) override {
    return Result::Ok;
  }
  Result OnOpcodeUint32(uint32_t value) override { return Result::Ok; }
  Result OnOpcodeUint32Uint32(uint32_t value, uint32_t value2) override {
    return Result::Ok;
  }
  Result OnOpcodeUint32Uint32Uint32(uint32_t value,
                                    uint32_t value2,
                                    uint32_t value3) override {
    return Result::Ok;
  }
  Result OnOpcodeUint64(uint64_t value) override { return Result::Ok; }
  Result OnOpcodeF32(uint32_t value) override { return Result::Ok; }
  Result OnOpcodeF64(uint64_t value) override { return Result::Ok; }
  Result OnOpcodeV128(v128 value) override { return Result::Ok; }
  Result OnOpcodeBlockSig(Type sig_type) override { return Result::Ok; }
  Result OnOpcodeType(Type type) override { return Result::Ok; }
  Result OnAtomicLoadExpr(Opcode opcode,
                          Address alignment_log2,
                          Address offset) override {
    return Result::Ok;
  }
  Result OnAtomicStoreExpr(Opcode opcode,
                           Address alignment_log2,
                           Address offset) override {
    return Result::Ok;
  }
  Result OnAtomicRmwExpr(Opcode opcode,
                         Address alignment_log2,
                         Address offset) override {
    return Result::Ok;
  }
  Result OnAtomicRmwCmpxchgExpr(Opcode opcode,
                                Address alignment_log2,
                                Address offset) override {
    return Result::Ok;
  }
  Result OnAtomicWaitExpr(Opcode, Address, Address) override {
    return Result::Ok;
  }
  Result OnAtomicFenceExpr(uint32_t) override {
    return Result::Ok;
  }
  Result OnAtomicNotifyExpr(Opcode, Address, Address) override {
    return Result::Ok;
  }
  Result OnBinaryExpr(Opcode opcode) override { return Result::Ok; }
  Result OnBlockExpr(Type sig_type) override { return Result::Ok; }
  Result OnBrExpr(Index depth) override { return Result::Ok; }
  Result OnBrIfExpr(Index depth) override { return Result::Ok; }
  Result OnBrTableExpr(Index num_targets,
                       Index* target_depths,
                       Index default_target_depth) override {
    return Result::Ok;
  }
  Result OnCallExpr(Index func_index) override { return Result::Ok; }
  Result OnCallIndirectExpr(Index sig_index, Index table_index) override { return Result::Ok; }
  Result OnCallRefExpr() override { return Result::Ok; }
  Result OnCatchExpr(Index tag_index) override { return Result::Ok; }
  Result OnCatchAllExpr() override { return Result::Ok; }
  Result OnCompareExpr(Opcode opcode) override { return Result::Ok; }
  Result OnConvertExpr(Opcode opcode) override { return Result::Ok; }
  Result OnDelegateExpr(Index depth) override { return Result::Ok; }
  Result OnDropExpr() override { return Result::Ok; }
  Result OnElseExpr() override { return Result::Ok; }
  Result OnEndExpr() override { return Result::Ok; }
  Result OnEndFunc() override { return Result::Ok; }
  Result OnF32ConstExpr(uint32_t value_bits) override { return Result::Ok; }
  Result OnF64ConstExpr(uint64_t value_bits) override { return Result::Ok; }
  Result OnV128ConstExpr(v128 value_bits) override { return Result::Ok; }
  Result OnGlobalGetExpr(Index global_index) override { return Result::Ok; }
  Result OnGlobalSetExpr(Index global_index) override { return Result::Ok; }
  Result OnI32ConstExpr(uint32_t value) override { return Result::Ok; }
  Result OnI64ConstExpr(uint64_t value) override { return Result::Ok; }
  Result OnIfExpr(Type sig_type) override { return Result::Ok; }
  Result OnLoadExpr(Opcode opcode,
                    Address alignment_log2,
                    Address offset) override {
    return Result::Ok;
  }
  Result OnLocalGetExpr(Index local_index) override { return Result::Ok; }
  Result OnLocalSetExpr(Index local_index) override { return Result::Ok; }
  Result OnLocalTeeExpr(Index local_index) override { return Result::Ok; }
  Result OnLoopExpr(Type sig_type) override { return Result::Ok; }
  Result OnMemoryCopyExpr() override { return Result::Ok; }
  Result OnDataDropExpr(Index segment_index) override { return Result::Ok; }
  Result OnMemoryFillExpr() override { return Result::Ok; }
  Result OnMemoryGrowExpr() override { return Result::Ok; }
  Result OnMemoryInitExpr(Index segment_index) override { return Result::Ok; }
  Result OnMemorySizeExpr() override { return Result::Ok; }
  Result OnTableCopyExpr(Index dst_index, Index src_index) override {
    return Result::Ok;
  }
  Result OnElemDropExpr(Index segment_index) override { return Result::Ok; }
  Result OnTableInitExpr(Index segment_index, Index table_index) override {
    return Result::Ok;
  }
  Result OnTableGetExpr(Index table_index) override { return Result::Ok; }
  Result OnTableSetExpr(Index table_index) override { return Result::Ok; }
  Result OnTableGrowExpr(Index table_index) override { return Result::Ok; }
  Result OnTableSizeExpr(Index table_index) override { return Result::Ok; }
  Result OnTableFillExpr(Index table_index) override { return Result::Ok; }
  Result OnRefFuncExpr(Index func_index) override { return Result::Ok; }
  Result OnRefNullExpr(Type type) override { return Result::Ok; }
  Result OnRefIsNullExpr() override { return Result::Ok; }
  Result OnNopExpr() override { return Result::Ok; }
  Result OnRethrowExpr(Index depth) override { return Result::Ok; }
  Result OnReturnCallExpr(Index sig_index) override { return Result::Ok; }
  Result OnReturnCallIndirectExpr(Index sig_index, Index table_index) override { return Result::Ok; }
  Result OnReturnExpr() override { return Result::Ok; }
  Result OnSelectExpr(Index result_count, Type* result_types) override {
    return Result::Ok;
  }
  Result OnStoreExpr(Opcode opcode,
                     Address alignment_log2,
                     Address offset) override {
    return Result::Ok;
  }
  Result OnThrowExpr(Index depth) override { return Result::Ok; }
  Result OnTryExpr(Type sig_type) override { return Result::Ok; }
  Result OnUnaryExpr(Opcode opcode) override { return Result::Ok; }
  Result OnTernaryExpr(Opcode opcode) override { return Result::Ok; }
  Result OnUnreachableExpr() override { return Result::Ok; }
  Result EndFunctionBody(Index index) override { return Result::Ok; }
  Result EndCodeSection() override { return Result::Ok; }
  Result OnSimdLaneOpExpr(Opcode opcode, uint64_t value) override {
    return Result::Ok;
  }
  Result OnSimdLoadLaneExpr(Opcode opcode,
                            Address alignment_log2,
                            Address offset,
                            uint64_t value) override {
    return Result::Ok;
  }
  Result OnSimdStoreLaneExpr(Opcode opcode,
                             Address alignment_log2,
                             Address offset,
                             uint64_t value) override {
    return Result::Ok;
  }
  Result OnSimdShuffleOpExpr(Opcode opcode, v128 value) override {
    return Result::Ok;
  }
  Result OnLoadSplatExpr(Opcode opcode,
                         Address alignment_log2,
                         Address offset) override {
    return Result::Ok;
  }
  Result OnLoadZeroExpr(Opcode opcode,
                        Address alignment_log2,
                        Address offset) override {
    return Result::Ok;
  }

  /* Elem section */
  Result BeginElemSection(Offset size) override { return Result::Ok; }
  Result OnElemSegmentCount(Index count) override { return Result::Ok; }
  Result BeginElemSegment(Index index,
                          Index table_index,
                          uint8_t flags) override {
    return Result::Ok;
  }
  Result BeginElemSegmentInitExpr(Index index) override { return Result::Ok; }
  Result EndElemSegmentInitExpr(Index index) override { return Result::Ok; }
  Result OnElemSegmentElemType(Index index, Type elem_type) override {
    return Result::Ok;
  }
  Result OnElemSegmentElemExprCount(Index index, Index count) override {
    return Result::Ok;
  }
  Result OnElemSegmentElemExpr_RefNull(Index segment_index,
                                       Type type) override {
    return Result::Ok;
  }
  Result OnElemSegmentElemExpr_RefFunc(Index segment_index,
                                       Index func_index) override {
    return Result::Ok;
  }
  Result EndElemSegment(Index index) override { return Result::Ok; }
  Result EndElemSection() override { return Result::Ok; }

  /* Data section */
  Result BeginDataSection(Offset size) override { return Result::Ok; }
  Result OnDataSegmentCount(Index count) override { return Result::Ok; }
  Result BeginDataSegment(Index index,
                          Index memory_index,
                          uint8_t flags) override {
    return Result::Ok;
  }
  Result BeginDataSegmentInitExpr(Index index) override { return Result::Ok; }
  Result EndDataSegmentInitExpr(Index index) override { return Result::Ok; }
  Result OnDataSegmentData(Index index,
                           const void* data,
                           Address size) override {
    return Result::Ok;
  }
  Result EndDataSegment(Index index) override { return Result::Ok; }
  Result EndDataSection() override { return Result::Ok; }

  /* DataCount section */
  Result BeginDataCountSection(Offset size) override { return Result::Ok; }
  Result OnDataCount(Index count) override { return Result::Ok; }
  Result EndDataCountSection() override { return Result::Ok; }

  /* Names section */
  Result BeginNamesSection(Offset size) override { return Result::Ok; }
  Result OnModuleNameSubsection(Index index,
                                uint32_t name_type,
                                Offset subsection_size) override {
    return Result::Ok;
  }
  Result OnModuleName(string_view name) override { return Result::Ok; }
  Result OnFunctionNameSubsection(Index index,
                                  uint32_t name_type,
                                  Offset subsection_size) override {
    return Result::Ok;
  }
  Result OnFunctionNamesCount(Index num_functions) override {
    return Result::Ok;
  }
  Result OnFunctionName(Index function_index,
                        string_view function_name) override {
    return Result::Ok;
  }
  Result OnLocalNameSubsection(Index index,
                               uint32_t name_type,
                               Offset subsection_size) override {
    return Result::Ok;
  }
  Result OnLocalNameFunctionCount(Index num_functions) override {
    return Result::Ok;
  }
  Result OnLocalNameLocalCount(Index function_index,
                               Index num_locals) override {
    return Result::Ok;
  }
  Result OnLocalName(Index function_index,
                     Index local_index,
                     string_view local_name) override {
    return Result::Ok;
  }
  Result EndNamesSection() override { return Result::Ok; }

  Result OnNameSubsection(Index index,
                          NameSectionSubsection subsection_type,
                          Offset subsection_size) override {
    return Result::Ok;
  }
  Result OnNameCount(Index num_names) override { return Result::Ok; }
  Result OnNameEntry(NameSectionSubsection type,
                     Index index,
                     string_view name) override {
    return Result::Ok;
  }

  /* Reloc section */
  Result BeginRelocSection(Offset size) override { return Result::Ok; }
  Result OnRelocCount(Index count, Index section_code) override {
    return Result::Ok;
  }
  Result OnReloc(RelocType type,
                 Offset offset,
                 Index index,
                 uint32_t addend) override {
    return Result::Ok;
  }
  Result EndRelocSection() override { return Result::Ok; }

  /* Tag section */
  Result BeginTagSection(Offset size) override { return Result::Ok; }
  Result OnTagCount(Index count) override { return Result::Ok; }
  Result OnTagType(Index index, Index sig_index) override { return Result::Ok; }
  Result EndTagSection() override { return Result::Ok; }

  /* Dylink section */
  Result BeginDylinkSection(Offset size) override { return Result::Ok; }
  Result OnDylinkInfo(uint32_t mem_size,
                      uint32_t mem_align,
                      uint32_t table_size,
                      uint32_t table_align) override {
    return Result::Ok;
  }
  Result OnDylinkNeededCount(Index count) override { return Result::Ok; }
  Result OnDylinkNeeded(string_view so_name) override { return Result::Ok; }
  Result EndDylinkSection() override { return Result::Ok; }

  /* Linking section */
  Result BeginLinkingSection(Offset size) override { return Result::Ok; }
  Result OnSymbolCount(Index count) override { return Result::Ok; }
  Result OnDataSymbol(Index index,
                      uint32_t flags,
                      string_view name,
                      Index segment,
                      uint32_t offset,
                      uint32_t size) override {
    return Result::Ok;
  }
  Result OnFunctionSymbol(Index index,
                          uint32_t flags,
                          string_view name,
                          Index func_index) override {
    return Result::Ok;
  }
  Result OnGlobalSymbol(Index index,
                        uint32_t flags,
                        string_view name,
                        Index global_index) override {
    return Result::Ok;
  }
  Result OnSectionSymbol(Index index,
                         uint32_t flags,
                         Index section_index) override {
    return Result::Ok;
  }
  Result OnTagSymbol(Index index,
                     uint32_t flags,
                     string_view name,
                     Index tag_index) override {
    return Result::Ok;
  }
  Result OnTableSymbol(Index index,
                       uint32_t flags,
                       string_view name,
                       Index table_index) override {
    return Result::Ok;
  }
  Result OnSegmentInfoCount(Index count) override { return Result::Ok; }
  Result OnSegmentInfo(Index index,
                       string_view name,
                       Address alignment,
                       uint32_t flags) override {
    return Result::Ok;
  }
  Result OnInitFunctionCount(Index count) override { return Result::Ok; }
  Result OnInitFunction(uint32_t priority, Index function_index) override {
    return Result::Ok;
  }
  Result OnComdatCount(Index count) override { return Result::Ok; }
  Result OnComdatBegin(string_view name, uint32_t flags, Index count) override {
    return Result::Ok;
  }
  Result OnComdatEntry(ComdatType kind, Index index) override {
    return Result::Ok;
  }
  Result EndLinkingSection() override { return Result::Ok; }

  /* InitExpr - used by elem, data and global sections; these functions are
   * only called between calls to Begin*InitExpr and End*InitExpr */
  Result OnInitExprF32ConstExpr(Index index, uint32_t value) override {
    return Result::Ok;
  }
  Result OnInitExprF64ConstExpr(Index index, uint64_t value) override {
    return Result::Ok;
  }
  Result OnInitExprV128ConstExpr(Index index, v128 value) override {
    return Result::Ok;
  }
  Result OnInitExprGlobalGetExpr(Index index, Index global_index) override {
    return Result::Ok;
  }
  Result OnInitExprI32ConstExpr(Index index, uint32_t value) override {
    return Result::Ok;
  }
  Result OnInitExprI64ConstExpr(Index index, uint64_t value) override {
    return Result::Ok;
  }
  Result OnInitExprRefNull(Index index, Type type) override {
    return Result::Ok;
  }
  Result OnInitExprRefFunc(Index index, Index func_index) override {
    return Result::Ok;
  }
};

}  // namespace wabt

#endif /* WABT_BINARY_READER_H_ */