public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] symtab reader: use C++11 `using` syntax instead of typedefs
@ 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
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Matthias Männich @ 2023-06-06  8:51 UTC (permalink / raw)
  To: libabigail; +Cc: dodji, gprocida, kernel-team, maennich

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>
---
 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-07 14:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-06  8:51 [PATCH 1/2] symtab reader: use C++11 `using` syntax instead of typedefs 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 ` [PATCH 1/2] symtab reader: use C++11 `using` syntax instead of typedefs Giuliano Procida
2023-06-07 14:46 ` Dodji Seketeli

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).