summaryrefslogtreecommitdiff
path: root/src/binary-reader-objdump.cc
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2021-12-20 19:35:01 -0800
committerGitHub <noreply@github.com>2021-12-20 19:35:01 -0800
commite59cf9369004a521814222afbc05ae6b59446cd5 (patch)
treed1a0483a4e6ec6334182a42bf1d0a532f9e3b8e9 /src/binary-reader-objdump.cc
parent8b92c44494ea3c03b38c12275098b682071b6101 (diff)
downloadwabt-e59cf9369004a521814222afbc05ae6b59446cd5.tar.gz
wabt-e59cf9369004a521814222afbc05ae6b59446cd5.tar.bz2
wabt-e59cf9369004a521814222afbc05ae6b59446cd5.zip
Clang-format codebase (#1684)
This applies clang-format to the whole codebase. I noticed we have .clang-format in wabt but the codebase is not very well formatted. This kind of mass-formatting PR has fans and skeptics because it can mess with `git blame`, but we did a similar thing in Binaryen a few years ago (WebAssembly/binaryen#2048, which was merged in WebAssembly/binaryen#2059) and it was not very confusing after all. If we are ever going to format the codebase, I think it is easier to do it in a single big PR than dozens of smaller PRs. This is using the existing .clang-format file in this repo, which follows the style of Chromium. If we think this does not suit the current formatting style, we can potentially tweak .clang-format too. For example, I noticed the current codebase puts many `case` statements within a single line when they are short, but the current .clang-format does not allow that. This does not include files in src/prebuilt, because they are generated. This also manually fixes some comment lines, because mechanically applying clang-format to long inline comments can look weird. I also added a clang-format check hook in the Github CI in #1683, which I think can be less controversial, given that it only checks the diff. --- After discussions, we ended up reverting many changes, especially one-liner functions and switch-cases, which are too many to wrap in `// clang-format off` and `// clang-format on`. I also considered fixing `.clang-format` to allow those one-liners but it caused a larger churn in other parts. So currently the codebase does not conform to `.clang-format` 100%, but we decided it's fine.
Diffstat (limited to 'src/binary-reader-objdump.cc')
-rw-r--r--src/binary-reader-objdump.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc
index 2ec05ddd..d1863405 100644
--- a/src/binary-reader-objdump.cc
+++ b/src/binary-reader-objdump.cc
@@ -476,7 +476,9 @@ class BinaryReaderObjdumpDisassemble : public BinaryReaderObjdumpBase {
Result OnOpcodeIndexIndex(Index value, Index value2) override;
Result OnOpcodeUint32(uint32_t value) override;
Result OnOpcodeUint32Uint32(uint32_t value, uint32_t value2) override;
- Result OnOpcodeUint32Uint32Uint32(uint32_t value, uint32_t value2, uint32_t value3) override;
+ Result OnOpcodeUint32Uint32Uint32(uint32_t value,
+ uint32_t value2,
+ uint32_t value3) override;
Result OnOpcodeUint64(uint64_t value) override;
Result OnOpcodeF32(uint32_t value) override;
Result OnOpcodeF64(uint64_t value) override;
@@ -2077,8 +2079,8 @@ Result BinaryReaderObjdump::OnSegmentInfo(Index index,
string_view name,
Address alignment_log2,
uint32_t flags) {
- PrintDetails(" - %d: " PRIstringview " p2align=%" PRIaddress,
- index, WABT_PRINTF_STRING_VIEW_ARG(name), alignment_log2);
+ PrintDetails(" - %d: " PRIstringview " p2align=%" PRIaddress, index,
+ WABT_PRINTF_STRING_VIEW_ARG(name), alignment_log2);
return PrintSegmentFlags(flags);
}
@@ -2097,7 +2099,9 @@ Result BinaryReaderObjdump::OnComdatCount(Index count) {
return Result::Ok;
}
-Result BinaryReaderObjdump::OnComdatBegin(string_view name, uint32_t flags, Index count) {
+Result BinaryReaderObjdump::OnComdatBegin(string_view name,
+ uint32_t flags,
+ Index count) {
PrintDetails(" - " PRIstringview ": [count=%d]\n",
WABT_PRINTF_STRING_VIEW_ARG(name), count);
return Result::Ok;