@@ -2761,7 +2761,7 @@ template <class ELFT> void DebugNamesSection<ELFT>::writeTo(uint8_t *buf) {
2761
2761
}
2762
2762
2763
2763
// Update the entries with the relocated string offsets.
2764
- for (auto &stringEntry : mergedEntries) {
2764
+ for (NamedEntry &stringEntry : mergedEntries) {
2765
2765
uint32_t oldOffset = stringEntry.stringOffsetOffset ;
2766
2766
uint32_t idx = stringEntry.chunkIdx ;
2767
2767
stringEntry.relocatedEntryOffset = chunksRelocs[idx][oldOffset];
@@ -2802,7 +2802,7 @@ template <class ELFT> void DebugNamesSection<ELFT>::writeTo(uint8_t *buf) {
2802
2802
// Write the hash table.
2803
2803
// ... Write the buckets
2804
2804
uint32_t idx = 1 ;
2805
- for (const auto &bucket : bucketList) {
2805
+ for (const SmallVector<NamedEntry *, 0 > &bucket : bucketList) {
2806
2806
if (!bucket.empty ())
2807
2807
endian::write32<ELFT::Endianness>(buf + 0 , idx);
2808
2808
idx += bucket.size ();
@@ -2819,7 +2819,7 @@ template <class ELFT> void DebugNamesSection<ELFT>::writeTo(uint8_t *buf) {
2819
2819
}
2820
2820
2821
2821
// Write the string offsets.
2822
- for (const auto &entry : mergedEntries) {
2822
+ for (const NamedEntry &entry : mergedEntries) {
2823
2823
endian::write32<ELFT::Endianness>(buf + 0 , entry.relocatedEntryOffset );
2824
2824
buf += 4 ;
2825
2825
}
@@ -2831,10 +2831,10 @@ template <class ELFT> void DebugNamesSection<ELFT>::writeTo(uint8_t *buf) {
2831
2831
}
2832
2832
2833
2833
// Write the abbrev table.
2834
- for (const auto *abbrev : mergedAbbrevTable) {
2834
+ for (const Abbrev *abbrev : mergedAbbrevTable) {
2835
2835
buf += encodeULEB128 (abbrev->code , buf);
2836
2836
buf += encodeULEB128 (abbrev->tag , buf);
2837
- for (auto attr : abbrev->attributes ) {
2837
+ for (DWARFDebugNames::AttributeEncoding attr : abbrev->attributes ) {
2838
2838
buf += encodeULEB128 (attr.Index , buf);
2839
2839
buf += encodeULEB128 (attr.Form , buf);
2840
2840
}
@@ -2846,7 +2846,7 @@ template <class ELFT> void DebugNamesSection<ELFT>::writeTo(uint8_t *buf) {
2846
2846
// Write the entry pool.
2847
2847
for (const auto &stringEntry : mergedEntries) {
2848
2848
// Write all the entries for the string.
2849
- for (const auto &entry : stringEntry.indexEntries ) {
2849
+ for (const std::unique_ptr<IndexEntry> &entry : stringEntry.indexEntries ) {
2850
2850
buf += encodeULEB128 (entry->abbrevCode , buf);
2851
2851
for (const auto &value : entry->attrValues ) {
2852
2852
endian::write32<ELFT::Endianness>(buf + 0 , value.attrValue );
@@ -2901,7 +2901,7 @@ static void readAttributeValues(
2901
2901
const LLDDWARFSection &namesSection = *chunk.namesSection ;
2902
2902
uint64_t *offsetPtr = &offset;
2903
2903
typename DebugNamesSection<ELFT>::AttrValueData cuOrTuAttr = {0 , 0 };
2904
- for (auto attr : abbrev.Attributes ) {
2904
+ for (DWARFDebugNames::AttributeEncoding attr : abbrev.Attributes ) {
2905
2905
Error err = Error::success ();
2906
2906
typename DebugNamesSection<ELFT>::AttrValueData newAttr;
2907
2907
uint32_t value;
@@ -3154,13 +3154,13 @@ std::pair<uint8_t, dwarf::Form> DebugNamesSection<ELFT>::getMergedCuSizeData() {
3154
3154
uint8_t size;
3155
3155
dwarf::Form form;
3156
3156
// TODO: Investigate possibly using DIEInteger::BestForm here
3157
- if (mergedHdr.CompUnitCount > 0xffffffff ) {
3157
+ if (mergedHdr.CompUnitCount > UINT32_MAX ) {
3158
3158
form = DW_FORM_data8;
3159
3159
size = 8 ;
3160
- } else if (mergedHdr.CompUnitCount > 0xffff ) {
3160
+ } else if (mergedHdr.CompUnitCount > UINT16_MAX ) {
3161
3161
form = DW_FORM_data4;
3162
3162
size = 4 ;
3163
- } else if (mergedHdr.CompUnitCount > 0xff ) {
3163
+ } else if (mergedHdr.CompUnitCount > UINT8_MAX ) {
3164
3164
form = DW_FORM_data2;
3165
3165
size = 2 ;
3166
3166
} else {
@@ -3192,7 +3192,8 @@ void DebugNamesSection<ELFT>::getMergedAbbrevTable(
3192
3192
compileUnitAttrForm);
3193
3193
newAbbrev.code = abbrev.Code ;
3194
3194
newAbbrev.tag = abbrev.Tag ;
3195
- for (const auto attr : abbrev.Attributes ) {
3195
+ for (const DWARFDebugNames::AttributeEncoding attr :
3196
+ abbrev.Attributes ) {
3196
3197
DWARFDebugNames::AttributeEncoding newAttr (attr.Index , attr.Form );
3197
3198
if (attr.Index == DW_IDX_compile_unit)
3198
3199
// Save it, to put it at the end.
@@ -3233,7 +3234,7 @@ void DebugNamesSection<ELFT>::getMergedAbbrevTable(
3233
3234
for (Abbrev *a : mergedAbbrevTable) {
3234
3235
mergedHdr.AbbrevTableSize += getULEB128Size (a->code );
3235
3236
mergedHdr.AbbrevTableSize += getULEB128Size (a->tag );
3236
- for (const auto &attr : a->attributes ) {
3237
+ for (const DWARFDebugNames::AttributeEncoding &attr : a->attributes ) {
3237
3238
mergedHdr.AbbrevTableSize += getULEB128Size (attr.Index );
3238
3239
mergedHdr.AbbrevTableSize += getULEB128Size (attr.Form );
3239
3240
}
@@ -3268,22 +3269,22 @@ void DebugNamesSection<ELFT>::getMergedSymbols(
3268
3269
parallelFor (0 , concurrency, [&](size_t threadId) {
3269
3270
for (size_t i = 0 , e = numChunks; i != e; ++i) {
3270
3271
DebugNamesInputChunk &chunk = inputChunks[i];
3271
- for (auto &secData : chunk.sectionsData ) {
3272
+ for (DebugNamesSectionData &secData : chunk.sectionsData ) {
3272
3273
// Deduplicate the NamedEntry records (based on the string/name),
3273
3274
// using a map from string/name to NamedEntry records.
3274
3275
// Note there is a twist: If there is already a record for the current
3275
3276
// 'string' in the nameMap, we append all the indexEntries from the
3276
3277
// current record to the record that's in the nameMap. I.e. we
3277
3278
// deduplicate the *strings* but we keep all the IndexEntry records
3278
3279
// (moving them to the appropriate 'kept' NamedEntry record).
3279
- for (auto &stringEntry : secData.namedEntries ) {
3280
+ for (NamedEntry &stringEntry : secData.namedEntries ) {
3280
3281
size_t shardId = stringEntry.hashValue >> shift;
3281
3282
if ((shardId & (concurrency - 1 )) != threadId)
3282
3283
continue ;
3283
3284
3284
3285
auto &shard = shards[shardId];
3285
3286
stringEntry.chunkIdx = i;
3286
- for (auto &entry : stringEntry.indexEntries ) {
3287
+ for (std::unique_ptr<IndexEntry> &entry : stringEntry.indexEntries ) {
3287
3288
// The DW_IDX_compile_unit is always the last attribute (we set it
3288
3289
// up that way when we read/created the attributes). We need to
3289
3290
// update the index value to use the correct merged offset, and we
@@ -3313,7 +3314,7 @@ void DebugNamesSection<ELFT>::getMergedSymbols(
3313
3314
});
3314
3315
3315
3316
// Combined the shared symbols into mergedEntries
3316
- for (auto &shard : shards)
3317
+ for (ShardData &shard : shards)
3317
3318
for (auto &mapEntry : shard.nameMap )
3318
3319
mergedEntries.push_back (std::move (mapEntry.second ));
3319
3320
mergedHdr.NameCount = mergedEntries.size ();
@@ -3330,14 +3331,14 @@ void DebugNamesSection<ELFT>::computeUniqueHashes(
3330
3331
3331
3332
template <class ELFT > void DebugNamesSection<ELFT>::generateBuckets() {
3332
3333
bucketList.resize (mergedHdr.BucketCount );
3333
- for (auto &entry : mergedEntries) {
3334
+ for (NamedEntry &entry : mergedEntries) {
3334
3335
uint32_t bucketIdx = entry.hashValue % mergedHdr.BucketCount ;
3335
3336
bucketList[bucketIdx].push_back (&entry);
3336
3337
}
3337
3338
3338
3339
// Sort the contents of the buckets by hash value so that the hash collisions
3339
3340
// end up together.
3340
- for (auto &bucket : bucketList)
3341
+ for (SmallVector<NamedEntry *, 0 > &bucket : bucketList)
3341
3342
stable_sort (bucket, [](NamedEntry *lhs, NamedEntry *rhs) {
3342
3343
return lhs->hashValue < rhs->hashValue ;
3343
3344
});
@@ -3348,7 +3349,7 @@ void DebugNamesSection<ELFT>::calculateEntriesSizeAndOffsets() {
3348
3349
uint32_t offset = 0 ;
3349
3350
for (NamedEntry &stringEntry : mergedEntries) {
3350
3351
stringEntry.entryOffset = offset;
3351
- for (auto &entry : stringEntry.indexEntries ) {
3352
+ for (std::unique_ptr<IndexEntry> &entry : stringEntry.indexEntries ) {
3352
3353
uint32_t entrySize = 0 ;
3353
3354
entry->poolOffset = offset;
3354
3355
entrySize += getULEB128Size (entry->abbrevCode );
@@ -3364,7 +3365,7 @@ void DebugNamesSection<ELFT>::calculateEntriesSizeAndOffsets() {
3364
3365
3365
3366
template <class ELFT > void DebugNamesSection<ELFT>::updateParentIndexEntries() {
3366
3367
for (NamedEntry &stringEntry : mergedEntries) {
3367
- for (auto &childEntry : stringEntry.indexEntries ) {
3368
+ for (std::unique_ptr<IndexEntry> &childEntry : stringEntry.indexEntries ) {
3368
3369
if (!childEntry->parentEntry )
3369
3370
continue ;
3370
3371
@@ -3377,7 +3378,7 @@ template <class ELFT> void DebugNamesSection<ELFT>::updateParentIndexEntries() {
3377
3378
// correct parent offset (in the merged entry pool).
3378
3379
for (size_t idx = 0 , size = abbrev->attributes .size (); idx != size;
3379
3380
++idx) {
3380
- auto attr = abbrev->attributes [idx];
3381
+ DWARFDebugNames::AttributeEncoding attr = abbrev->attributes [idx];
3381
3382
if (attr.Index == DW_IDX_parent && attr.Form == DW_FORM_ref4)
3382
3383
childEntry->attrValues [idx].attrValue =
3383
3384
childEntry->parentEntry ->poolOffset ;
0 commit comments