[Lldb-commits] [PATCH] D56170: RangeMap.h: merge RangeDataArray and RangeDataVector

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 2 09:59:56 PST 2019


clayborg added inline comments.


================
Comment at: include/lldb/Core/RangeMap.h:636
 
-template <typename B, typename S, typename T, unsigned N> class RangeDataArray {
+template <typename B, typename S, typename T, unsigned N>
+class RangeDataVector {
----------------
labath wrote:
> tberghammer wrote:
> > Would it make sense to have a default value of 0 for N so people don't have to specify it explicitly?
> I don't have an clear opinion on that. On one hand, 0 seems like a perfectly reasonable default, but on the other SmallVector doesn't have a default either. Everyone typedefs these anyway, so it doesn't really matter.
Can we default N to be zero?
```
template <typename B, typename S, typename T, unsigned N=0>
```
Then remove the zero parameter from many of the changes in this patch?



================
Comment at: include/lldb/Symbol/DWARFCallFrameInfo.h:117
   // offset into an individual Module.
-  typedef RangeDataVector<lldb::addr_t, uint32_t, dw_offset_t> FDEEntryMap;
+  typedef RangeDataVector<lldb::addr_t, uint32_t, dw_offset_t, 0> FDEEntryMap;
 
----------------
We can remove the last zero parameter if we default its value in the template definition


================
Comment at: include/lldb/Symbol/LineTable.h:233
   //------------------------------------------------------------------
-  typedef RangeDataVector<lldb::addr_t, lldb::addr_t, lldb::addr_t>
+  typedef RangeDataVector<lldb::addr_t, lldb::addr_t, lldb::addr_t, 0>
       FileRangeMap;
----------------
We can remove the last zero parameter if we default its value in the template definition


================
Comment at: include/lldb/Symbol/Symtab.h:150
   typedef collection::const_iterator const_iterator;
-  typedef RangeDataVector<lldb::addr_t, lldb::addr_t, uint32_t>
+  typedef RangeDataVector<lldb::addr_t, lldb::addr_t, uint32_t, 0>
       FileRangeToIndexMap;
----------------
We can remove the last zero parameter if we default its value in the template definition


================
Comment at: source/Plugins/Process/elf-core/ProcessElfCore.h:139-140
   typedef lldb_private::Range<lldb::addr_t, lldb::addr_t> FileRange;
-  typedef lldb_private::RangeDataArray<lldb::addr_t, lldb::addr_t, FileRange, 1>
+  typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, FileRange,
+                                        0>
       VMRangeToFileOffset;
----------------
We can remove the last zero parameter if we default its value in the template definition


================
Comment at: source/Plugins/Process/elf-core/ProcessElfCore.h:142
       VMRangeToFileOffset;
-  typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, uint32_t>
+  typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, uint32_t, 0>
       VMRangeToPermissions;
----------------
We can remove the last zero parameter if we default its value in the template definition


================
Comment at: source/Plugins/Process/mach-core/ProcessMachCore.h:133-134
   typedef lldb_private::Range<lldb::addr_t, lldb::addr_t> FileRange;
-  typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, FileRange>
+  typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, FileRange,
+                                        0>
       VMRangeToFileOffset;
----------------
We can remove the last zero parameter if we default its value in the template definition




================
Comment at: source/Plugins/Process/mach-core/ProcessMachCore.h:136
       VMRangeToFileOffset;
-  typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, uint32_t>
+  typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, uint32_t, 0>
       VMRangeToPermissions;
----------------
Ditto


================
Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h:22
 protected:
-  typedef lldb_private::RangeDataArray<dw_addr_t, uint32_t, dw_offset_t, 1>
+  typedef lldb_private::RangeDataVector<dw_addr_t, uint32_t, dw_offset_t, 1>
       RangeToDIE;
----------------
Should this default to zero instead of 1? Not many DWARFDebugAranges will have just a single address.


================
Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h:443
   typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t,
-                                        lldb_private::Variable *>
+                                        lldb_private::Variable *, 0>
       GlobalVariableMap;
----------------
We can remove the last zero parameter if we default its value in the template definition




================
Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h:159
   typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t,
-                                        lldb::addr_t>
+                                        lldb::addr_t, 0>
       FileRangeMap;
----------------
We can remove the last zero parameter if we default its value in the template definition




================
Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h:302
 
-  typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, OSOEntry>
+  typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, OSOEntry, 0>
       DebugMap;
----------------
We can remove the last zero parameter if we default its value in the template definition




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56170/new/

https://reviews.llvm.org/D56170





More information about the lldb-commits mailing list