[llvm] [InstrRef][nfc] Remove usage of unique_ptrs of arrays (PR #74203)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 3 09:17:52 PST 2023


================
@@ -205,11 +205,11 @@ namespace LiveDebugValues {
 using namespace llvm;
 
 /// Type for a table of values in a block.
-using ValueTable = std::unique_ptr<ValueIDNum[]>;
+using ValueTable = SmallVector<ValueIDNum, 0>;
 
 /// Type for a table-of-table-of-values, i.e., the collection of either
 /// live-in or live-out values for each block in the function.
-using FuncValueTable = std::unique_ptr<ValueTable[]>;
+using FuncValueTable = SmallVector<ValueTable, 0>;
----------------
dwblaikie wrote:

(personally, I find code easier to read when it doesn't obscure these outer templates like `unique_ptr` or `SmallVector` (ie: I'd rather avoid/remove these aliases and have code refer to `SmallVector<ValueTable, 0>` directly) - and the name might be a bit misleading too, if we're going to keep it, `FuncValueTable` - it isn't a single value table, it's a sequence of them - so like `ValueTableVector`? (at least that hints at it being a sequence, which is helpful - I guess the old name couldn't do that because `unique_ptr<T[]>` doesn't have begin/end or even a length, etc))

https://github.com/llvm/llvm-project/pull/74203


More information about the llvm-commits mailing list