@@ -138,11 +138,11 @@ void AppleAccelTableBase::emitData(AsmPrinter *Asm) {
138
138
Asm->EmitInt32 (0 );
139
139
// Remember to emit the label for our offset.
140
140
Asm->OutStreamer ->EmitLabel (Hash->Sym );
141
- Asm->OutStreamer ->AddComment (Hash->Str );
142
- Asm->emitDwarfStringOffset (Hash->Data . Name );
141
+ Asm->OutStreamer ->AddComment (Hash->Name . getString () );
142
+ Asm->emitDwarfStringOffset (Hash->Name );
143
143
Asm->OutStreamer ->AddComment (" Num DIEs" );
144
- Asm->EmitInt32 (Hash->Data . Values .size ());
145
- for (const auto *V : Hash->Data . Values ) {
144
+ Asm->EmitInt32 (Hash->Values .size ());
145
+ for (const auto *V : Hash->Values ) {
146
146
V->emit (Asm);
147
147
}
148
148
PrevHash = Hash->HashValue ;
@@ -155,9 +155,10 @@ void AppleAccelTableBase::emitData(AsmPrinter *Asm) {
155
155
156
156
void AppleAccelTableBase::computeBucketCount () {
157
157
// First get the number of unique hashes.
158
- std::vector<uint32_t > uniques (Data.size ());
159
- for (size_t i = 0 , e = Data.size (); i < e; ++i)
160
- uniques[i] = Data[i]->HashValue ;
158
+ std::vector<uint32_t > uniques;
159
+ uniques.reserve (Entries.size ());
160
+ for (const auto &E : Entries)
161
+ uniques.push_back (E.second .HashValue );
161
162
array_pod_sort (uniques.begin (), uniques.end ());
162
163
std::vector<uint32_t >::iterator p =
163
164
std::unique (uniques.begin (), uniques.end ());
@@ -169,7 +170,6 @@ void AppleAccelTableBase::computeBucketCount() {
169
170
170
171
void AppleAccelTableBase::finalizeTable (AsmPrinter *Asm, StringRef Prefix) {
171
172
// Create the individual hash data outputs.
172
- Data.reserve (Entries.size ());
173
173
for (auto &E : Entries) {
174
174
// Unique the entries.
175
175
std::stable_sort (E.second .Values .begin (), E.second .Values .end (),
@@ -178,9 +178,6 @@ void AppleAccelTableBase::finalizeTable(AsmPrinter *Asm, StringRef Prefix) {
178
178
E.second .Values .erase (
179
179
std::unique (E.second .Values .begin (), E.second .Values .end ()),
180
180
E.second .Values .end ());
181
-
182
- HashData *Entry = new (Allocator) HashData (E.first (), E.second );
183
- Data.push_back (Entry);
184
181
}
185
182
186
183
// Figure out how many buckets we need, then compute the bucket contents and
@@ -192,10 +189,10 @@ void AppleAccelTableBase::finalizeTable(AsmPrinter *Asm, StringRef Prefix) {
192
189
193
190
// Compute bucket contents and final ordering.
194
191
Buckets.resize (Header.getBucketCount ());
195
- for (auto &D : Data ) {
196
- uint32_t bucket = D-> HashValue % Header.getBucketCount ();
197
- Buckets[bucket].push_back (D );
198
- D-> Sym = Asm->createTempSymbol (Prefix);
192
+ for (auto &E : Entries ) {
193
+ uint32_t bucket = E. second . HashValue % Header.getBucketCount ();
194
+ Buckets[bucket].push_back (&E. second );
195
+ E. second . Sym = Asm->createTempSymbol (Prefix);
199
196
}
200
197
201
198
// Sort the contents of the buckets by hash value so that hash collisions end
@@ -286,16 +283,16 @@ void AppleAccelTableHeader::print(raw_ostream &OS) const {
286
283
HeaderData.print (OS);
287
284
}
288
285
289
- void AppleAccelTableBase::HashData::print (raw_ostream &OS) {
290
- OS << " Name: " << Str << " \n " ;
286
+ void AppleAccelTableBase::HashData::print (raw_ostream &OS) const {
287
+ OS << " Name: " << Name. getString () << " \n " ;
291
288
OS << " Hash Value: " << format (" 0x%x" , HashValue) << " \n " ;
292
289
OS << " Symbol: " ;
293
290
if (Sym)
294
291
OS << *Sym;
295
292
else
296
293
OS << " <none>" ;
297
294
OS << " \n " ;
298
- for (auto *Value : Data. Values )
295
+ for (auto *Value : Values)
299
296
Value->print (OS);
300
297
}
301
298
@@ -317,8 +314,8 @@ void AppleAccelTableBase::print(raw_ostream &OS) const {
317
314
Hash->print (OS);
318
315
319
316
OS << " Data: \n " ;
320
- for (auto &D : Data )
321
- D-> print (OS);
317
+ for (auto &E : Entries )
318
+ E. second . print (OS);
322
319
}
323
320
324
321
void AppleAccelTableOffsetData::print (raw_ostream &OS) const {
0 commit comments