src/wasm/wasm-validator.cpp
bool WasmValidator::validate(Module& module, FeatureSet features, Flags flags) {
  ValidationInfo info;
  info.validateWeb = (flags & Web) != 0;
  info.validateGlobally = (flags & Globally) != 0;
  info.features = features;
  info.quiet = (flags & Quiet) != 0;
  // parallel wasm logic validation
  PassRunner runner(&module);
  runner.add<FunctionValidator>(&info);
  runner.setIsNested(true);
  runner.run();
  // validate globally
  if (info.validateGlobally) {
    validateImports(module, info);
    validateExports(module, info);
    validateGlobals(module, info);
    validateMemory(module, info);
    validateTable(module, info);
    validateModule(module, info);
  }
  // validate additional internal IR details when in pass-debug mode
  if (PassRunner::getPassDebug()) {
    validateBinaryenIR(module, info);
  }
  // print all the data
  if (!info.valid.load() && !info.quiet) {
    for (auto& func : module.functions) {
      std::cerr << info.getStream(func.get()).str();
    }
    std::cerr << info.getStream(nullptr).str();
  }
  return info.valid.load();
}
// TODO: If we want the validator to be part of libwasm rather than libpasses, then
// Using PassRunner::getPassDebug causes a circular dependence. We should fix that,
// perhaps by moving some of the pass infrastructure into libsupport.
If we want the validator to be part of libwasm rather than libpasses, then
Using PassRunner::getPassDebug causes a circular dependence. We should fix that,
perhaps by moving some of the pass infrastructure into libsupport.
If we want the validator to be part of libwasm rather than libpasses then Using PassRunner :: getPassDebug causes a circular dependence . We should fix that perhaps by moving some of the pass infrastructure into libsupport .
bool WasmValidator::validate(Module& module, FeatureSet features, Flags flags) {
  ValidationInfo info;
  info.validateWeb = (flags & Web) != 0;
  info.validateGlobally = (flags & Globally) != 0;
  info.features = features;
  info.quiet = (flags & Quiet) != 0;
  PassRunner runner(&module);
  runner.add<FunctionValidator>(&info);
  runner.setIsNested(true);
  runner.run();
  if (info.validateGlobally) {
    validateImports(module, info);
    validateExports(module, info);
    validateGlobals(module, info);
    validateMemory(module, info);
    validateTable(module, info);
    validateModule(module, info);
  }
  if (PassRunner::getPassDebug()) {
    validateBinaryenIR(module, info);
  }
  if (!info.valid.load() && !info.quiet) {
    for (auto& func : module.functions) {
      std::cerr << info.getStream(func.get()).str();
    }
    std::cerr << info.getStream(nullptr).str();
  }
  return info.valid.load();
}
bool WasmValidator :: validate ( Module & module , FeatureSet features , Flags flags ) { ValidationInfo info ; info . validateWeb = ( flags & Web ) != 0 ; info . validateGlobally = ( flags & Globally ) != 0 ; info . features = features ; info . quiet = ( flags & Quiet ) != 0 ; PassRunner runner ( & module ) ; runner . add < FunctionValidator > ( & info ) ; runner . setIsNested ( true ) ; runner . run ( ) ; if ( info . validateGlobally ) { validateImports ( module , info ) ; validateExports ( module , info ) ; validateGlobals ( module , info ) ; validateMemory ( module , info ) ; validateTable ( module , info ) ; validateModule ( module , info ) ; } if ( PassRunner :: getPassDebug ( ) ) { validateBinaryenIR ( module , info ) ; } if ( ! info . valid . load ( ) && ! info . quiet ) { for ( auto & func : module . functions ) { std :: cerr << info . getStream ( func . get ( ) ) . str ( ) ; } std :: cerr << info . getStream ( nullptr ) . str ( ) ; } return info . valid . load ( ) ; }
TODO: If we want the validator to be part of libwasm rather than libpasses, then
Using PassRunner::getPassDebug causes a circular dependence.
TODO : If we want the validator to be part of libwasm rather than libpasses then Using PassRunner :: getPassDebug causes a circular dependence .
// parallel wasm logic validation // validate globally // validate additional internal IR details when in pass-debug mode // print all the data