public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Giuliano Procida <gprocida@google.com>
To: "Matthias Männich" <maennich@google.com>
Cc: libabigail@sourceware.org, dodji@seketeli.org, kernel-team@android.com
Subject: Re: [PATCH 1/2] symtab reader: use C++11 `using` syntax instead of typedefs
Date: Wed, 7 Jun 2023 07:52:59 +0100	[thread overview]
Message-ID: <CAGvU0HkFZK2=wpHd6Q-SHzfwDzkN1sjhJvedt-1nrKS00HDjPw@mail.gmail.com> (raw)
In-Reply-To: <20230606085132.1894137-3-maennich@google.com>

On Tue, 6 Jun 2023 at 09:52, Matthias Männich <maennich@google.com> wrote:
>
> From: Matthias Maennich <maennich@google.com>
>
> That is to increase readability and to incrementally modernize the code base.
>
>         * abg-symtab-reader.h: replace typedefs by corresponding using
>           declarations.
>
> Signed-off-by: Matthias Maennich <maennich@google.com>

Reviewed-by: Giuliano Procida <gprocida@google.com>

> ---
>  src/abg-symtab-reader.h | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/src/abg-symtab-reader.h b/src/abg-symtab-reader.h
> index 2e13e7f9976f..7477cca5a6f0 100644
> --- a/src/abg-symtab-reader.h
> +++ b/src/abg-symtab-reader.h
> @@ -99,7 +99,7 @@ private:
>  /// Base iterator for our custom iterator based on whatever the const_iterator
>  /// is for a vector of symbols.
>  /// As of writing this, std::vector<elf_symbol_sptr>::const_iterator.
> -typedef elf_symbols::const_iterator base_iterator;
> +using base_iterator = elf_symbols::const_iterator;
>
>  /// An iterator to walk a vector of elf_symbols filtered by symtab_filter.
>  ///
> @@ -110,11 +110,11 @@ typedef elf_symbols::const_iterator base_iterator;
>  class symtab_iterator : public base_iterator
>  {
>  public:
> -  typedef base_iterator::value_type     value_type;
> -  typedef base_iterator::reference      reference;
> -  typedef base_iterator::pointer        pointer;
> -  typedef base_iterator::difference_type difference_type;
> -  typedef std::forward_iterator_tag     iterator_category;
> +  using value_type = base_iterator::value_type;
> +  using reference = base_iterator::reference;
> +  using pointer = base_iterator::pointer;
> +  using difference_type = base_iterator::difference_type;
> +  using iterator_category = std::forward_iterator_tag;
>
>    /// Construct the iterator based on a pair of underlying iterators and a
>    /// symtab_filter object. Immediately fast forward to the next element that
> @@ -172,7 +172,7 @@ private:
>
>  /// Convenience declaration of a unique_ptr<symtab>
>  class symtab;
> -typedef std::unique_ptr<symtab> symtab_ptr;
> +using symtab_ptr = std::unique_ptr<symtab>;
>
>  /// symtab is the actual data container of the symtab_reader implementation.
>  ///
> @@ -201,7 +201,7 @@ typedef std::unique_ptr<symtab> symtab_ptr;
>  class symtab
>  {
>  public:
> -  typedef std::function<bool(const elf_symbol_sptr&)> symbol_predicate;
> +  using symbol_predicate = std::function<bool(const elf_symbol_sptr&)>;
>
>    /// Indicate whether any (kernel) symbols have been seen at construction.
>    ///
> @@ -215,7 +215,7 @@ public:
>
>    /// The (only) iterator type we offer is a const_iterator implemented by the
>    /// symtab_iterator.
> -  typedef symtab_iterator const_iterator;
> +  using const_iterator = symtab_iterator;
>
>    /// Obtain an iterator to the beginning of the symtab according to the filter
>    /// criteria. Whenever this iterator advances, it skips elements that do not
> @@ -271,12 +271,12 @@ private:
>    bool has_ksymtab_entries_;
>
>    /// Lookup map name->symbol(s)
> -  typedef std::unordered_map<std::string, std::vector<elf_symbol_sptr>>
> -                      name_symbol_map_type;
> +  using name_symbol_map_type =
> +      std::unordered_map<std::string, std::vector<elf_symbol_sptr>>;
>    name_symbol_map_type name_symbol_map_;
>
>    /// Lookup map addr->symbol
> -  typedef std::unordered_map<GElf_Addr, elf_symbol_sptr> addr_symbol_map_type;
> +  using addr_symbol_map_type = std::unordered_map<GElf_Addr, elf_symbol_sptr>;
>    addr_symbol_map_type addr_symbol_map_;
>
>    /// Lookup map function entry address -> symbol
> --
> 2.41.0.rc0.172.g3f132b7071-goog
>

  parent reply	other threads:[~2023-06-07  6:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06  8:51 Matthias Männich
2023-06-06  8:51 ` [PATCH 2/2] symtab reader: fix symtab iterator to support C++20 Matthias Männich
2023-06-07  6:53   ` Giuliano Procida
2023-06-07 14:46   ` Dodji Seketeli
2023-06-07  6:52 ` Giuliano Procida [this message]
2023-06-07 14:46 ` [PATCH 1/2] symtab reader: use C++11 `using` syntax instead of typedefs Dodji Seketeli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGvU0HkFZK2=wpHd6Q-SHzfwDzkN1sjhJvedt-1nrKS00HDjPw@mail.gmail.com' \
    --to=gprocida@google.com \
    --cc=dodji@seketeli.org \
    --cc=kernel-team@android.com \
    --cc=libabigail@sourceware.org \
    --cc=maennich@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).