summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2022-11-15 09:18:19 -0800
committerGitHub <noreply@github.com>2022-11-15 17:18:19 +0000
commit7566af8c129d92720e91472adc63dd308f751a9d (patch)
tree11d0696ae4f55b4fbcdb0c2456194e1e0681ebdd /src/tools
parentd3e4ab30720c48d0c019fa521d70362b1bdd2bae (diff)
downloadwabt-7566af8c129d92720e91472adc63dd308f751a9d.tar.gz
wabt-7566af8c129d92720e91472adc63dd308f751a9d.tar.bz2
wabt-7566af8c129d92720e91472adc63dd308f751a9d.zip
Switch from `typedef` to using `using` in C++ code. NFC (#2066)
This is more modern and (IMHO) easier to read than that old C typedef syntax.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/spectest-interp.cc26
-rw-r--r--src/tools/wasm-opcodecnt.cc8
2 files changed, 17 insertions, 17 deletions
diff --git a/src/tools/spectest-interp.cc b/src/tools/spectest-interp.cc
index 5df00894..6b07fa46 100644
--- a/src/tools/spectest-interp.cc
+++ b/src/tools/spectest-interp.cc
@@ -99,8 +99,8 @@ static void ParseOptions(int argc, char** argv) {
namespace spectest {
class Command;
-typedef std::unique_ptr<Command> CommandPtr;
-typedef std::vector<CommandPtr> CommandPtrVector;
+using CommandPtr = std::unique_ptr<Command>;
+using CommandPtrVector = std::vector<CommandPtr>;
class Script {
public:
@@ -155,7 +155,7 @@ class ActionCommandBase : public CommandMixin<TypeEnum> {
Action action;
};
-typedef ActionCommandBase<CommandType::Action> ActionCommand;
+using ActionCommand = ActionCommandBase<CommandType::Action>;
class RegisterCommand : public CommandMixin<CommandType::Register> {
public:
@@ -289,9 +289,9 @@ class AssertTrapCommandBase : public CommandMixin<TypeEnum> {
std::string text;
};
-typedef AssertTrapCommandBase<CommandType::AssertTrap> AssertTrapCommand;
-typedef AssertTrapCommandBase<CommandType::AssertExhaustion>
- AssertExhaustionCommand;
+using AssertTrapCommand = AssertTrapCommandBase<CommandType::AssertTrap>;
+using AssertExhaustionCommand =
+ AssertTrapCommandBase<CommandType::AssertExhaustion>;
template <CommandType TypeEnum>
class AssertModuleCommand : public CommandMixin<TypeEnum> {
@@ -301,13 +301,13 @@ class AssertModuleCommand : public CommandMixin<TypeEnum> {
std::string text;
};
-typedef AssertModuleCommand<CommandType::AssertMalformed>
- AssertMalformedCommand;
-typedef AssertModuleCommand<CommandType::AssertInvalid> AssertInvalidCommand;
-typedef AssertModuleCommand<CommandType::AssertUnlinkable>
- AssertUnlinkableCommand;
-typedef AssertModuleCommand<CommandType::AssertUninstantiable>
- AssertUninstantiableCommand;
+using AssertMalformedCommand =
+ AssertModuleCommand<CommandType::AssertMalformed>;
+using AssertInvalidCommand = AssertModuleCommand<CommandType::AssertInvalid>;
+using AssertUnlinkableCommand =
+ AssertModuleCommand<CommandType::AssertUnlinkable>;
+using AssertUninstantiableCommand =
+ AssertModuleCommand<CommandType::AssertUninstantiable>;
class AssertExceptionCommand
: public CommandMixin<CommandType::AssertException> {
diff --git a/src/tools/wasm-opcodecnt.cc b/src/tools/wasm-opcodecnt.cc
index 63153d39..058d807f 100644
--- a/src/tools/wasm-opcodecnt.cc
+++ b/src/tools/wasm-opcodecnt.cc
@@ -98,7 +98,7 @@ static size_t SumCounts(const OpcodeInfoCounts& info_counts) {
}
void WriteCounts(Stream& stream, const OpcodeInfoCounts& info_counts) {
- typedef std::pair<Opcode, size_t> OpcodeCountPair;
+ using OpcodeCountPair = std::pair<Opcode, size_t>;
std::map<Opcode, size_t> counts;
for (auto& [info, count] : info_counts) {
@@ -122,9 +122,9 @@ void WriteCounts(Stream& stream, const OpcodeInfoCounts& info_counts) {
void WriteCountsWithImmediates(Stream& stream, const OpcodeInfoCounts& counts) {
// Remove const from the key type so we can sort below.
- typedef std::pair<std::remove_const<OpcodeInfoCounts::key_type>::type,
- OpcodeInfoCounts::mapped_type>
- OpcodeInfoCountPair;
+ using OpcodeInfoCountPair =
+ std::pair<std::remove_const<OpcodeInfoCounts::key_type>::type,
+ OpcodeInfoCounts::mapped_type>;
std::vector<OpcodeInfoCountPair> sorted;
std::copy_if(counts.begin(), counts.end(), std::back_inserter(sorted),