@@ -704,13 +704,10 @@ class ASTRecordWriter {
704
704
// / declaration or type.
705
705
SmallVector<Stmt *, 16 > StmtsToEmit;
706
706
707
- // / Worst case: bases, vbases, visible and lexical contents, local redecls.
708
- static const int MaxOffsetIndices = 5 ;
709
707
// / \brief Indices of record elements that describe offsets within the
710
708
// / bitcode. These will be converted to offsets relative to the current
711
709
// / record when emitted.
712
- unsigned OffsetIndices[MaxOffsetIndices];
713
- unsigned NumOffsetIndices = 0 ;
710
+ SmallVector<unsigned , 8 > OffsetIndices;
714
711
715
712
// / \brief Flush all of the statements and expressions that have
716
713
// / been added to the queue via AddStmt().
@@ -719,13 +716,13 @@ class ASTRecordWriter {
719
716
720
717
void PrepareToEmit (uint64_t MyOffset) {
721
718
// Convert offsets into relative form.
722
- for (unsigned I = 0 ; I != NumOffsetIndices; ++I ) {
723
- auto &StoredOffset = (*Record)[OffsetIndices[I] ];
719
+ for (unsigned I : OffsetIndices ) {
720
+ auto &StoredOffset = (*Record)[I ];
724
721
assert (StoredOffset < MyOffset && " invalid offset" );
725
722
if (StoredOffset)
726
723
StoredOffset = MyOffset - StoredOffset;
727
724
}
728
- NumOffsetIndices = 0 ;
725
+ OffsetIndices. clear () ;
729
726
}
730
727
731
728
public:
@@ -779,8 +776,7 @@ class ASTRecordWriter {
779
776
// / \brief Add a bit offset into the record. This will be converted into an
780
777
// / offset relative to the current record when emitted.
781
778
void AddOffset (uint64_t BitOffset) {
782
- assert (NumOffsetIndices != MaxOffsetIndices && " too many offset indices" );
783
- OffsetIndices[NumOffsetIndices++] = Record->size ();
779
+ OffsetIndices.push_back (Record->size ());
784
780
Record->push_back (BitOffset);
785
781
}
786
782
0 commit comments