@@ -127,20 +127,32 @@ typedef std::vector<FixupList> FixupScopeList;
127
127
typedef SmallSetVector<CachedHashString, 16 > PredicateSet;
128
128
typedef SmallSetVector<CachedHashString, 16 > DecoderSet;
129
129
130
- struct DecoderTable : public std ::vector<uint8_t > {
130
+ class DecoderTable {
131
+ public:
132
+ DecoderTable () { Data.reserve (16384 ); }
133
+
134
+ void clear () { Data.clear (); }
135
+ void push_back (uint8_t Item) { Data.push_back (Item); }
136
+ size_t size () const { return Data.size (); }
137
+ const uint8_t *data () const { return Data.data (); }
138
+
139
+ using const_iterator = std::vector<uint8_t >::const_iterator;
140
+ const_iterator begin () const { return Data.begin (); }
141
+ const_iterator end () const { return Data.end (); }
142
+
131
143
// Insert a ULEB128 encoded value into the table.
132
144
void insertULEB128 (uint64_t Value) {
133
145
// Encode and emit the value to filter against.
134
146
uint8_t Buffer[16 ];
135
147
unsigned Len = encodeULEB128 (Value, Buffer);
136
- insert (end (), Buffer, Buffer + Len);
148
+ Data. insert (Data. end (), Buffer, Buffer + Len);
137
149
}
138
150
139
151
// Insert space for `NumToSkip` and return the position
140
152
// in the table for patching.
141
153
size_t insertNumToSkip () {
142
- size_t Size = size ();
143
- insert (end (), getNumToSkipInBytes (), 0 );
154
+ size_t Size = Data. size ();
155
+ Data. insert (Data. end (), getNumToSkipInBytes (), 0 );
144
156
return Size;
145
157
}
146
158
@@ -156,11 +168,14 @@ struct DecoderTable : public std::vector<uint8_t> {
156
168
PrintFatalError (
157
169
" disassembler decoding table too large, try --large-decoder-table" );
158
170
159
- (* this ) [FixupIdx] = static_cast <uint8_t >(Delta);
160
- (* this ) [FixupIdx + 1 ] = static_cast <uint8_t >(Delta >> 8 );
171
+ Data [FixupIdx] = static_cast <uint8_t >(Delta);
172
+ Data [FixupIdx + 1 ] = static_cast <uint8_t >(Delta >> 8 );
161
173
if (getNumToSkipInBytes () == 3 )
162
- (* this ) [FixupIdx + 2 ] = static_cast <uint8_t >(Delta >> 16 );
174
+ Data [FixupIdx + 2 ] = static_cast <uint8_t >(Delta >> 16 );
163
175
}
176
+
177
+ private:
178
+ std::vector<uint8_t > Data;
164
179
};
165
180
166
181
struct DecoderTableInfo {
@@ -2517,7 +2532,6 @@ namespace {
2517
2532
// decoders to give more opportunities for uniqueing.
2518
2533
TableInfo.Table .clear ();
2519
2534
TableInfo.FixupStack .clear ();
2520
- TableInfo.Table .reserve (16384 );
2521
2535
TableInfo.FixupStack .emplace_back ();
2522
2536
FC.emitTableEntries (TableInfo);
2523
2537
// Any NumToSkip fixups in the top level scope can resolve to the
0 commit comments