summaryrefslogtreecommitdiff
path: root/src/binary-reader-logging.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/binary-reader-logging.cc')
-rw-r--r--src/binary-reader-logging.cc150
1 files changed, 75 insertions, 75 deletions
diff --git a/src/binary-reader-logging.cc b/src/binary-reader-logging.cc
index 2d0ada8f..71352611 100644
--- a/src/binary-reader-logging.cc
+++ b/src/binary-reader-logging.cc
@@ -24,7 +24,7 @@ namespace wabt {
#define INDENT_SIZE 2
-#define LOGF_NOINDENT(...) stream->Writef(__VA_ARGS__)
+#define LOGF_NOINDENT(...) stream_->Writef(__VA_ARGS__)
#define LOGF(...) \
do { \
@@ -50,15 +50,15 @@ void SPrintLimits(char* dst, size_t size, const Limits* limits) {
BinaryReaderLogging::BinaryReaderLogging(Stream* stream,
BinaryReaderDelegate* forward)
- : stream(stream), reader(forward), indent(0) {}
+ : stream_(stream), reader_(forward), indent_(0) {}
void BinaryReaderLogging::Indent() {
- indent += INDENT_SIZE;
+ indent_ += INDENT_SIZE;
}
void BinaryReaderLogging::Dedent() {
- indent -= INDENT_SIZE;
- assert(indent >= 0);
+ indent_ -= INDENT_SIZE;
+ assert(indent_ >= 0);
}
void BinaryReaderLogging::WriteIndent() {
@@ -66,13 +66,13 @@ void BinaryReaderLogging::WriteIndent() {
" "
" ";
static const size_t s_indent_len = sizeof(s_indent) - 1;
- size_t i = indent;
+ size_t i = indent_;
while (i > s_indent_len) {
- stream->WriteData(s_indent, s_indent_len);
+ stream_->WriteData(s_indent, s_indent_len);
i -= s_indent_len;
}
if (i > 0) {
- stream->WriteData(s_indent, indent);
+ stream_->WriteData(s_indent, indent_);
}
}
@@ -91,23 +91,23 @@ void BinaryReaderLogging::LogTypes(TypeVector& types) {
}
bool BinaryReaderLogging::OnError(const char* message) {
- return reader->OnError(message);
+ return reader_->OnError(message);
}
void BinaryReaderLogging::OnSetState(const State* s) {
BinaryReaderDelegate::OnSetState(s);
- reader->OnSetState(s);
+ reader_->OnSetState(s);
}
Result BinaryReaderLogging::BeginModule(uint32_t version) {
LOGF("BeginModule(version: %u)\n", version);
Indent();
- return reader->BeginModule(version);
+ return reader_->BeginModule(version);
}
Result BinaryReaderLogging::BeginSection(BinarySection section_type,
Offset size) {
- return reader->BeginSection(section_type, size);
+ return reader_->BeginSection(section_type, size);
}
Result BinaryReaderLogging::BeginCustomSection(Offset size,
@@ -115,7 +115,7 @@ Result BinaryReaderLogging::BeginCustomSection(Offset size,
LOGF("BeginCustomSection('" PRIstringview "', size: %" PRIzd ")\n",
WABT_PRINTF_STRING_VIEW_ARG(section_name), size);
Indent();
- return reader->BeginCustomSection(size, section_name);
+ return reader_->BeginCustomSection(size, section_name);
}
Result BinaryReaderLogging::OnType(Index index,
@@ -128,8 +128,8 @@ Result BinaryReaderLogging::OnType(Index index,
LOGF_NOINDENT(", results: ");
LogTypes(result_count, result_types);
LOGF_NOINDENT(")\n");
- return reader->OnType(index, param_count, param_types, result_count,
- result_types);
+ return reader_->OnType(index, param_count, param_types, result_count,
+ result_types);
}
Result BinaryReaderLogging::OnImport(Index index,
@@ -139,7 +139,7 @@ Result BinaryReaderLogging::OnImport(Index index,
"\", field: \"" PRIstringview "\")\n",
index, WABT_PRINTF_STRING_VIEW_ARG(module_name),
WABT_PRINTF_STRING_VIEW_ARG(field_name));
- return reader->OnImport(index, module_name, field_name);
+ return reader_->OnImport(index, module_name, field_name);
}
Result BinaryReaderLogging::OnImportFunc(Index import_index,
@@ -150,8 +150,8 @@ Result BinaryReaderLogging::OnImportFunc(Index import_index,
LOGF("OnImportFunc(import_index: %" PRIindex ", func_index: %" PRIindex
", sig_index: %" PRIindex ")\n",
import_index, func_index, sig_index);
- return reader->OnImportFunc(import_index, module_name, field_name, func_index,
- sig_index);
+ return reader_->OnImportFunc(import_index, module_name, field_name,
+ func_index, sig_index);
}
Result BinaryReaderLogging::OnImportTable(Index import_index,
@@ -165,8 +165,8 @@ Result BinaryReaderLogging::OnImportTable(Index import_index,
LOGF("OnImportTable(import_index: %" PRIindex ", table_index: %" PRIindex
", elem_type: %s, %s)\n",
import_index, table_index, GetTypeName(elem_type), buf);
- return reader->OnImportTable(import_index, module_name, field_name,
- table_index, elem_type, elem_limits);
+ return reader_->OnImportTable(import_index, module_name, field_name,
+ table_index, elem_type, elem_limits);
}
Result BinaryReaderLogging::OnImportMemory(Index import_index,
@@ -179,8 +179,8 @@ Result BinaryReaderLogging::OnImportMemory(Index import_index,
LOGF("OnImportMemory(import_index: %" PRIindex ", memory_index: %" PRIindex
", %s)\n",
import_index, memory_index, buf);
- return reader->OnImportMemory(import_index, module_name, field_name,
- memory_index, page_limits);
+ return reader_->OnImportMemory(import_index, module_name, field_name,
+ memory_index, page_limits);
}
Result BinaryReaderLogging::OnImportGlobal(Index import_index,
@@ -194,8 +194,8 @@ Result BinaryReaderLogging::OnImportGlobal(Index import_index,
"%s)\n",
import_index, global_index, GetTypeName(type),
mutable_ ? "true" : "false");
- return reader->OnImportGlobal(import_index, module_name, field_name,
- global_index, type, mutable_);
+ return reader_->OnImportGlobal(import_index, module_name, field_name,
+ global_index, type, mutable_);
}
Result BinaryReaderLogging::OnImportException(Index import_index,
@@ -208,8 +208,8 @@ Result BinaryReaderLogging::OnImportException(Index import_index,
import_index, except_index);
LogTypes(sig);
LOGF_NOINDENT(")\n");
- return reader->OnImportException(import_index, module_name, field_name,
- except_index, sig);
+ return reader_->OnImportException(import_index, module_name, field_name,
+ except_index, sig);
}
Result BinaryReaderLogging::OnTable(Index index,
@@ -219,20 +219,20 @@ Result BinaryReaderLogging::OnTable(Index index,
SPrintLimits(buf, sizeof(buf), elem_limits);
LOGF("OnTable(index: %" PRIindex ", elem_type: %s, %s)\n", index,
GetTypeName(elem_type), buf);
- return reader->OnTable(index, elem_type, elem_limits);
+ return reader_->OnTable(index, elem_type, elem_limits);
}
Result BinaryReaderLogging::OnMemory(Index index, const Limits* page_limits) {
char buf[100];
SPrintLimits(buf, sizeof(buf), page_limits);
LOGF("OnMemory(index: %" PRIindex ", %s)\n", index, buf);
- return reader->OnMemory(index, page_limits);
+ return reader_->OnMemory(index, page_limits);
}
Result BinaryReaderLogging::BeginGlobal(Index index, Type type, bool mutable_) {
LOGF("BeginGlobal(index: %" PRIindex ", type: %s, mutable: %s)\n", index,
GetTypeName(type), mutable_ ? "true" : "false");
- return reader->BeginGlobal(index, type, mutable_);
+ return reader_->BeginGlobal(index, type, mutable_);
}
Result BinaryReaderLogging::OnExport(Index index,
@@ -242,7 +242,7 @@ Result BinaryReaderLogging::OnExport(Index index,
LOGF("OnExport(index: %" PRIindex ", kind: %s, item_index: %" PRIindex
", name: \"" PRIstringview "\")\n",
index, GetKindName(kind), item_index, WABT_PRINTF_STRING_VIEW_ARG(name));
- return reader->OnExport(index, kind, item_index, name);
+ return reader_->OnExport(index, kind, item_index, name);
}
Result BinaryReaderLogging::OnLocalDecl(Index decl_index,
@@ -250,24 +250,24 @@ Result BinaryReaderLogging::OnLocalDecl(Index decl_index,
Type type) {
LOGF("OnLocalDecl(index: %" PRIindex ", count: %" PRIindex ", type: %s)\n",
decl_index, count, GetTypeName(type));
- return reader->OnLocalDecl(decl_index, count, type);
+ return reader_->OnLocalDecl(decl_index, count, type);
}
Result BinaryReaderLogging::OnBlockExpr(Index num_types, Type* sig_types) {
LOGF("OnBlockExpr(sig: ");
LogTypes(num_types, sig_types);
LOGF_NOINDENT(")\n");
- return reader->OnBlockExpr(num_types, sig_types);
+ return reader_->OnBlockExpr(num_types, sig_types);
}
Result BinaryReaderLogging::OnBrExpr(Index depth) {
LOGF("OnBrExpr(depth: %" PRIindex ")\n", depth);
- return reader->OnBrExpr(depth);
+ return reader_->OnBrExpr(depth);
}
Result BinaryReaderLogging::OnBrIfExpr(Index depth) {
LOGF("OnBrIfExpr(depth: %" PRIindex ")\n", depth);
- return reader->OnBrIfExpr(depth);
+ return reader_->OnBrIfExpr(depth);
}
Result BinaryReaderLogging::OnBrTableExpr(Index num_targets,
@@ -280,46 +280,46 @@ Result BinaryReaderLogging::OnBrTableExpr(Index num_targets,
LOGF_NOINDENT(", ");
}
LOGF_NOINDENT("], default: %" PRIindex ")\n", default_target_depth);
- return reader->OnBrTableExpr(num_targets, target_depths,
- default_target_depth);
+ return reader_->OnBrTableExpr(num_targets, target_depths,
+ default_target_depth);
}
Result BinaryReaderLogging::OnExceptionType(Index index, TypeVector& sig) {
LOGF("OnType(index: %" PRIindex ", values: ", index);
LogTypes(sig);
LOGF_NOINDENT(")\n");
- return reader->OnExceptionType(index, sig);
+ return reader_->OnExceptionType(index, sig);
}
Result BinaryReaderLogging::OnF32ConstExpr(uint32_t value_bits) {
float value;
memcpy(&value, &value_bits, sizeof(value));
LOGF("OnF32ConstExpr(%g (0x04%x))\n", value, value_bits);
- return reader->OnF32ConstExpr(value_bits);
+ return reader_->OnF32ConstExpr(value_bits);
}
Result BinaryReaderLogging::OnF64ConstExpr(uint64_t value_bits) {
double value;
memcpy(&value, &value_bits, sizeof(value));
LOGF("OnF64ConstExpr(%g (0x08%" PRIx64 "))\n", value, value_bits);
- return reader->OnF64ConstExpr(value_bits);
+ return reader_->OnF64ConstExpr(value_bits);
}
Result BinaryReaderLogging::OnI32ConstExpr(uint32_t value) {
LOGF("OnI32ConstExpr(%u (0x%x))\n", value, value);
- return reader->OnI32ConstExpr(value);
+ return reader_->OnI32ConstExpr(value);
}
Result BinaryReaderLogging::OnI64ConstExpr(uint64_t value) {
LOGF("OnI64ConstExpr(%" PRIu64 " (0x%" PRIx64 "))\n", value, value);
- return reader->OnI64ConstExpr(value);
+ return reader_->OnI64ConstExpr(value);
}
Result BinaryReaderLogging::OnIfExpr(Index num_types, Type* sig_types) {
LOGF("OnIfExpr(sig: ");
LogTypes(num_types, sig_types);
LOGF_NOINDENT(")\n");
- return reader->OnIfExpr(num_types, sig_types);
+ return reader_->OnIfExpr(num_types, sig_types);
}
Result BinaryReaderLogging::OnLoadExpr(Opcode opcode,
@@ -328,14 +328,14 @@ Result BinaryReaderLogging::OnLoadExpr(Opcode opcode,
LOGF("OnLoadExpr(opcode: \"%s\" (%u), align log2: %u, offset: %" PRIaddress
")\n",
opcode.GetName(), opcode.GetCode(), alignment_log2, offset);
- return reader->OnLoadExpr(opcode, alignment_log2, offset);
+ return reader_->OnLoadExpr(opcode, alignment_log2, offset);
}
Result BinaryReaderLogging::OnLoopExpr(Index num_types, Type* sig_types) {
LOGF("OnLoopExpr(sig: ");
LogTypes(num_types, sig_types);
LOGF_NOINDENT(")\n");
- return reader->OnLoopExpr(num_types, sig_types);
+ return reader_->OnLoopExpr(num_types, sig_types);
}
Result BinaryReaderLogging::OnStoreExpr(Opcode opcode,
@@ -344,14 +344,14 @@ Result BinaryReaderLogging::OnStoreExpr(Opcode opcode,
LOGF("OnStoreExpr(opcode: \"%s\" (%u), align log2: %u, offset: %" PRIaddress
")\n",
opcode.GetName(), opcode.GetCode(), alignment_log2, offset);
- return reader->OnStoreExpr(opcode, alignment_log2, offset);
+ return reader_->OnStoreExpr(opcode, alignment_log2, offset);
}
Result BinaryReaderLogging::OnTryExpr(Index num_types, Type* sig_types) {
LOGF("OnTryExpr(sig: ");
LogTypes(num_types, sig_types);
LOGF_NOINDENT(")\n");
- return reader->OnTryExpr(num_types, sig_types);
+ return reader_->OnTryExpr(num_types, sig_types);
}
Result BinaryReaderLogging::OnDataSegmentData(Index index,
@@ -359,7 +359,7 @@ Result BinaryReaderLogging::OnDataSegmentData(Index index,
Address size) {
LOGF("OnDataSegmentData(index:%" PRIindex ", size:%" PRIaddress ")\n", index,
size);
- return reader->OnDataSegmentData(index, data, size);
+ return reader_->OnDataSegmentData(index, data, size);
}
Result BinaryReaderLogging::OnFunctionNameSubsection(Index index,
@@ -368,13 +368,13 @@ Result BinaryReaderLogging::OnFunctionNameSubsection(Index index,
LOGF("OnFunctionNameSubsection(index:%" PRIindex ", nametype:%u, size:%" PRIzd
")\n",
index, name_type, subsection_size);
- return reader->OnFunctionNameSubsection(index, name_type, subsection_size);
+ return reader_->OnFunctionNameSubsection(index, name_type, subsection_size);
}
Result BinaryReaderLogging::OnFunctionName(Index index, string_view name) {
LOGF("OnFunctionName(index: %" PRIindex ", name: \"" PRIstringview "\")\n",
index, WABT_PRINTF_STRING_VIEW_ARG(name));
- return reader->OnFunctionName(index, name);
+ return reader_->OnFunctionName(index, name);
}
Result BinaryReaderLogging::OnLocalNameSubsection(Index index,
@@ -383,7 +383,7 @@ Result BinaryReaderLogging::OnLocalNameSubsection(Index index,
LOGF("OnLocalNameSubsection(index:%" PRIindex ", nametype:%u, size:%" PRIzd
")\n",
index, name_type, subsection_size);
- return reader->OnLocalNameSubsection(index, name_type, subsection_size);
+ return reader_->OnLocalNameSubsection(index, name_type, subsection_size);
}
Result BinaryReaderLogging::OnLocalName(Index func_index,
@@ -392,7 +392,7 @@ Result BinaryReaderLogging::OnLocalName(Index func_index,
LOGF("OnLocalName(func_index: %" PRIindex ", local_index: %" PRIindex
", name: \"" PRIstringview "\")\n",
func_index, local_index, WABT_PRINTF_STRING_VIEW_ARG(name));
- return reader->OnLocalName(func_index, local_index, name);
+ return reader_->OnLocalName(func_index, local_index, name);
}
Result BinaryReaderLogging::OnInitExprF32ConstExpr(Index index,
@@ -401,7 +401,7 @@ Result BinaryReaderLogging::OnInitExprF32ConstExpr(Index index,
memcpy(&value, &value_bits, sizeof(value));
LOGF("OnInitExprF32ConstExpr(index: %" PRIindex ", value: %g (0x04%x))\n",
index, value, value_bits);
- return reader->OnInitExprF32ConstExpr(index, value_bits);
+ return reader_->OnInitExprF32ConstExpr(index, value_bits);
}
Result BinaryReaderLogging::OnInitExprF64ConstExpr(Index index,
@@ -411,21 +411,21 @@ Result BinaryReaderLogging::OnInitExprF64ConstExpr(Index index,
LOGF("OnInitExprF64ConstExpr(index: %" PRIindex " value: %g (0x08%" PRIx64
"))\n",
index, value, value_bits);
- return reader->OnInitExprF64ConstExpr(index, value_bits);
+ return reader_->OnInitExprF64ConstExpr(index, value_bits);
}
Result BinaryReaderLogging::OnInitExprI32ConstExpr(Index index,
uint32_t value) {
LOGF("OnInitExprI32ConstExpr(index: %" PRIindex ", value: %u)\n", index,
value);
- return reader->OnInitExprI32ConstExpr(index, value);
+ return reader_->OnInitExprI32ConstExpr(index, value);
}
Result BinaryReaderLogging::OnInitExprI64ConstExpr(Index index,
uint64_t value) {
LOGF("OnInitExprI64ConstExpr(index: %" PRIindex ", value: %" PRIu64 ")\n",
index, value);
- return reader->OnInitExprI64ConstExpr(index, value);
+ return reader_->OnInitExprI64ConstExpr(index, value);
}
Result BinaryReaderLogging::OnRelocCount(Index count,
@@ -435,7 +435,7 @@ Result BinaryReaderLogging::OnRelocCount(Index count,
", section: %s, section_name: " PRIstringview ")\n",
count, GetSectionName(section_code),
WABT_PRINTF_STRING_VIEW_ARG(section_name));
- return reader->OnRelocCount(count, section_code, section_name);
+ return reader_->OnRelocCount(count, section_code, section_name);
}
Result BinaryReaderLogging::OnReloc(RelocType type,
@@ -446,58 +446,58 @@ Result BinaryReaderLogging::OnReloc(RelocType type,
LOGF("OnReloc(type: %s, offset: %" PRIzd ", index: %" PRIindex
", addend: %d)\n",
GetRelocTypeName(type), offset, index, signed_addend);
- return reader->OnReloc(type, offset, index, addend);
+ return reader_->OnReloc(type, offset, index, addend);
}
Result BinaryReaderLogging::OnSymbolInfo(string_view name, uint32_t flags) {
LOGF("(OnSymbolInfo name: " PRIstringview ", flags: 0x%x)\n",
WABT_PRINTF_STRING_VIEW_ARG(name), flags);
- return reader->OnSymbolInfo(name, flags);
+ return reader_->OnSymbolInfo(name, flags);
}
#define DEFINE_BEGIN(name) \
Result BinaryReaderLogging::name(Offset size) { \
LOGF(#name "(%" PRIzd ")\n", size); \
Indent(); \
- return reader->name(size); \
+ return reader_->name(size); \
}
#define DEFINE_END(name) \
Result BinaryReaderLogging::name() { \
Dedent(); \
LOGF(#name "\n"); \
- return reader->name(); \
+ return reader_->name(); \
}
#define DEFINE_INDEX(name) \
Result BinaryReaderLogging::name(Index value) { \
LOGF(#name "(%" PRIindex ")\n", value); \
- return reader->name(value); \
+ return reader_->name(value); \
}
#define DEFINE_INDEX_DESC(name, desc) \
Result BinaryReaderLogging::name(Index value) { \
LOGF(#name "(" desc ": %" PRIindex ")\n", value); \
- return reader->name(value); \
+ return reader_->name(value); \
}
#define DEFINE_INDEX_INDEX(name, desc0, desc1) \
Result BinaryReaderLogging::name(Index value0, Index value1) { \
LOGF(#name "(" desc0 ": %" PRIindex ", " desc1 ": %" PRIindex ")\n", \
value0, value1); \
- return reader->name(value0, value1); \
+ return reader_->name(value0, value1); \
}
#define DEFINE_OPCODE(name) \
Result BinaryReaderLogging::name(Opcode opcode) { \
LOGF(#name "(\"%s\" (%u))\n", opcode.GetName(), opcode.GetCode()); \
- return reader->name(opcode); \
+ return reader_->name(opcode); \
}
#define DEFINE0(name) \
Result BinaryReaderLogging::name() { \
LOGF(#name "\n"); \
- return reader->name(); \
+ return reader_->name(); \
}
DEFINE_END(EndModule)
@@ -614,44 +614,44 @@ DEFINE_END(EndExceptionSection);
// We don't need to log these (the individual opcodes are logged instead), but
// we still need to forward the calls.
Result BinaryReaderLogging::OnOpcode(Opcode opcode) {
- return reader->OnOpcode(opcode);
+ return reader_->OnOpcode(opcode);
}
Result BinaryReaderLogging::OnOpcodeBare() {
- return reader->OnOpcodeBare();
+ return reader_->OnOpcodeBare();
}
Result BinaryReaderLogging::OnOpcodeIndex(Index value) {
- return reader->OnOpcodeIndex(value);
+ return reader_->OnOpcodeIndex(value);
}
Result BinaryReaderLogging::OnOpcodeUint32(uint32_t value) {
- return reader->OnOpcodeUint32(value);
+ return reader_->OnOpcodeUint32(value);
}
Result BinaryReaderLogging::OnOpcodeUint32Uint32(uint32_t value,
uint32_t value2) {
- return reader->OnOpcodeUint32Uint32(value, value2);
+ return reader_->OnOpcodeUint32Uint32(value, value2);
}
Result BinaryReaderLogging::OnOpcodeUint64(uint64_t value) {
- return reader->OnOpcodeUint64(value);
+ return reader_->OnOpcodeUint64(value);
}
Result BinaryReaderLogging::OnOpcodeF32(uint32_t value) {
- return reader->OnOpcodeF32(value);
+ return reader_->OnOpcodeF32(value);
}
Result BinaryReaderLogging::OnOpcodeF64(uint64_t value) {
- return reader->OnOpcodeF64(value);
+ return reader_->OnOpcodeF64(value);
}
Result BinaryReaderLogging::OnOpcodeBlockSig(Index num_types, Type* sig_types) {
- return reader->OnOpcodeBlockSig(num_types, sig_types);
+ return reader_->OnOpcodeBlockSig(num_types, sig_types);
}
Result BinaryReaderLogging::OnEndFunc() {
- return reader->OnEndFunc();
+ return reader_->OnEndFunc();
}
} // namespace wabt