[llvm] [LLVM][DWARF] Make dwarf::getDebugNamesBucketCount return a pair. (PR #83047)
Felipe de Azevedo Piovezan via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 26 12:02:32 PST 2024
================
@@ -616,20 +616,21 @@ enum AcceleratorTable {
// Uniquify the string hashes and calculate the bucket count for the
// DWARF v5 Accelerator Table. NOTE: This function effectively consumes the
// 'hashes' input parameter.
-inline uint32_t getDebugNamesBucketCount(MutableArrayRef<uint32_t> hashes,
- uint32_t &uniqueHashCount) {
- uint32_t BucketCount = 0;
+inline std::pair<uint32_t, uint32_t> getDebugNamesBucketAndHashCount(
+ MutableArrayRef<uint32_t> hashes) {
+ uint32_t uniqueHashCount = 0;
----------------
felipepiovezan wrote:
we should avoid declaring-then-initializing as much as possible, this should be moved to where the variable is actually computed:
```
uint32_t uniqueHashCount = llvm::unique(hashes) - hashes.begin();
```
https://github.com/llvm/llvm-project/pull/83047
More information about the llvm-commits
mailing list