From 0bff1d2776e0da589dd98eca69e7f04fb07dfd02 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 14 Jan 2020 19:36:53 +0300 Subject: clang-format all the code --- utils/enum_symbols.cpp | 94 +++++++++++++++++++------------------------------- 1 file changed, 36 insertions(+), 58 deletions(-) (limited to 'utils/enum_symbols.cpp') diff --git a/utils/enum_symbols.cpp b/utils/enum_symbols.cpp index 8fa0960..0759dd6 100644 --- a/utils/enum_symbols.cpp +++ b/utils/enum_symbols.cpp @@ -4,9 +4,8 @@ // Distributed under the MIT License. #include "command_line.hpp" -#include "pdb_descr.hpp" - #include "pdb/all.hpp" +#include "pdb_descr.hpp" #pragma warning(push, 0) #include @@ -17,88 +16,67 @@ #include #include -namespace -{ - class EnumSymbols : public SettingsParser - { - public: - explicit EnumSymbols(const std::string& argv0) - : SettingsParser{argv0} - { - visible.add_options() - ("pdb", - boost::program_options::value>(&pdbs) - ->value_name("ADDR,PATH"), - "load a PDB file") - ("functions", - boost::program_options::value(&tag) - ->implicit_value(function_tag) - ->zero_tokens(), - "only list functions"); - } +namespace { - const char* get_short_description() const override - { - return "[-h|--help] [--pdb ADDR,PATH]... [--functions]"; - } +class EnumSymbols : public SettingsParser { +public: + explicit EnumSymbols(const std::string& argv0) : SettingsParser{argv0} { + namespace po = boost::program_options; - std::vector pdbs; + visible.add_options()( + "pdb", po::value>(&pdbs)->value_name("ADDR,PATH"), "load a PDB file"); + visible.add_options()( + "functions", + po::value(&tag)->implicit_value(function_tag)->zero_tokens(), + "only list functions"); + } - bool type_specified() const - { - return tag != reserved_tag; - } + const char* get_short_description() const override { + return "[-h|--help] [--pdb ADDR,PATH]... [--functions]"; + } - pdb::Symbol::Type get_type() const - { - return static_cast(tag); - } + std::vector pdbs; - private: - static const auto reserved_tag = static_cast(pdb::Symbol::Type::RESERVED); - static const auto function_tag = static_cast(pdb::Symbol::Type::Function); + bool type_specified() const { return tag != reserved_tag; } - pdb::Symbol::Tag tag = reserved_tag; - }; -} + pdb::Symbol::Type get_type() const { return static_cast(tag); } + +private: + static const auto reserved_tag = static_cast(pdb::Symbol::Type::RESERVED); + static const auto function_tag = static_cast(pdb::Symbol::Type::Function); + + pdb::Symbol::Tag tag = reserved_tag; +}; -int main(int argc, char* argv[]) -{ - try - { +} // namespace + +int main(int argc, char* argv[]) { + try { EnumSymbols settings{argv[0]}; - try - { + try { settings.parse(argc, argv); - } - catch (const boost::program_options::error& e) - { + } catch (const boost::program_options::error& e) { settings.usage_error(e); return 1; } - if (settings.exit_with_usage) - { + if (settings.exit_with_usage) { settings.usage(); return 0; } pdb::Repo repo; - for (const auto& pdb : settings.pdbs) - { + for (const auto& pdb : settings.pdbs) { const auto id = repo.add_pdb(pdb.online_base, pdb.path); - repo.enum_symbols(id, [&] (const pdb::Symbol& symbol) - { + repo.enum_symbols(id, [&](const pdb::Symbol& symbol) { if (!settings.type_specified() || settings.get_type() == symbol.get_type()) std::cout << symbol.get_name() << '\n'; }); } - } - catch (const std::exception& e) - { + } catch (const std::exception& e) { std::cerr << "error: " << e.what() << '\n'; return 1; } -- cgit v1.2.3