[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
diff --git a/llvm/tools/obj2yaml/wasm2yaml.cpp b/llvm/tools/obj2yaml/wasm2yaml.cpp
index c51a816..8e7f2fa 100644
--- a/llvm/tools/obj2yaml/wasm2yaml.cpp
+++ b/llvm/tools/obj2yaml/wasm2yaml.cpp
@@ -31,7 +31,7 @@
} // namespace
-static WasmYAML::Table make_table(const wasm::WasmTable &Table) {
+static WasmYAML::Table makeTable(const wasm::WasmTable &Table) {
WasmYAML::Table T;
T.ElemType = Table.ElemType;
T.TableLimits.Flags = Table.Limits.Flags;
@@ -40,7 +40,7 @@
return T;
}
-static WasmYAML::Limits make_limits(const wasm::WasmLimits &Limits) {
+static WasmYAML::Limits makeLimits(const wasm::WasmLimits &Limits) {
WasmYAML::Limits L;
L.Flags = Limits.Flags;
L.Initial = Limits.Initial;
@@ -194,7 +194,7 @@
if (FunctionSig.Returns.size())
Sig.ReturnType = static_cast<uint32_t>(FunctionSig.Returns[0]);
for (const auto &ParamType : FunctionSig.Params)
- Sig.ParamTypes.push_back(static_cast<uint32_t>(ParamType));
+ Sig.ParamTypes.emplace_back(static_cast<uint32_t>(ParamType));
TypeSec->Signatures.push_back(Sig);
}
S = std::move(TypeSec);
@@ -220,10 +220,10 @@
Im.EventImport.SigIndex = Import.Event.SigIndex;
break;
case wasm::WASM_EXTERNAL_TABLE:
- Im.TableImport = make_table(Import.Table);
+ Im.TableImport = makeTable(Import.Table);
break;
case wasm::WASM_EXTERNAL_MEMORY:
- Im.Memory = make_limits(Import.Memory);
+ Im.Memory = makeLimits(Import.Memory);
break;
}
ImportSec->Imports.push_back(Im);
@@ -242,7 +242,7 @@
case wasm::WASM_SEC_TABLE: {
auto TableSec = make_unique<WasmYAML::TableSection>();
for (const wasm::WasmTable &Table : Obj.tables()) {
- TableSec->Tables.push_back(make_table(Table));
+ TableSec->Tables.push_back(makeTable(Table));
}
S = std::move(TableSec);
break;
@@ -250,7 +250,7 @@
case wasm::WASM_SEC_MEMORY: {
auto MemorySec = make_unique<WasmYAML::MemorySection>();
for (const wasm::WasmLimits &Memory : Obj.memories()) {
- MemorySec->Memories.push_back(make_limits(Memory));
+ MemorySec->Memories.push_back(makeLimits(Memory));
}
S = std::move(MemorySec);
break;