File tree Expand file tree Collapse file tree 4 files changed +26
-6
lines changed Expand file tree Collapse file tree 4 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,14 @@ class Mangler {
78
78
}
79
79
};
80
80
81
+ void addSubstWordsInIdent (const WordReplacement &repl) {
82
+ SubstWordsInIdent.push_back (repl);
83
+ }
84
+
85
+ void addWord (const SubstitutionWord &word) {
86
+ Words.push_back (word);
87
+ }
88
+
81
89
// / Returns the buffer as a StringRef, needed by mangleIdentifier().
82
90
StringRef getBufferStr () const {
83
91
return StringRef (Storage.data (), Storage.size ());
Original file line number Diff line number Diff line change @@ -279,7 +279,11 @@ template<typename T> class Vector {
279
279
Capacity = 0 ;
280
280
Elems = 0 ;
281
281
}
282
-
282
+
283
+ void clear () {
284
+ NumElems = 0 ;
285
+ }
286
+
283
287
iterator begin () { return Elems; }
284
288
iterator end () { return Elems + NumElems; }
285
289
Original file line number Diff line number Diff line change @@ -160,13 +160,13 @@ void mangleIdentifier(Mangler &M, StringRef ident) {
160
160
if (WordIdx >= 0 ) {
161
161
// We found a word substitution!
162
162
assert (WordIdx < 26 );
163
- M.SubstWordsInIdent . push_back ({wordStartPos, WordIdx});
163
+ M.addSubstWordsInIdent ({wordStartPos, WordIdx});
164
164
} else if (wordLen >= 2 && M.Words .size () < M.MaxNumWords ) {
165
165
// It's a new word: remember it.
166
166
// Note: at this time the word's start position is relative to the
167
167
// begin of the identifier. We must update it afterwards so that it is
168
168
// relative to the begin of the whole mangled Buffer.
169
- M.Words . push_back ({wordStartPos, wordLen});
169
+ M.addWord ({wordStartPos, wordLen});
170
170
}
171
171
wordStartPos = NotInsideWord;
172
172
}
@@ -181,7 +181,7 @@ void mangleIdentifier(Mangler &M, StringRef ident) {
181
181
182
182
size_t Pos = 0 ;
183
183
// Add a dummy-word at the end of the list.
184
- M.SubstWordsInIdent . push_back ({ident.size (), -1 });
184
+ M.addSubstWordsInIdent ({ident.size (), -1 });
185
185
186
186
// Mangle a sequence of word substitutions and sub-strings.
187
187
for (size_t Idx = 0 , End = M.SubstWordsInIdent .size (); Idx < End; ++Idx) {
Original file line number Diff line number Diff line change @@ -155,8 +155,8 @@ class Remangler {
155
155
156
156
DemanglerPrinter &Buffer;
157
157
158
- std::vector <SubstitutionWord> Words;
159
- std::vector <WordReplacement> SubstWordsInIdent;
158
+ Vector <SubstitutionWord> Words;
159
+ Vector <WordReplacement> SubstWordsInIdent;
160
160
161
161
static const size_t MaxNumWords = 26 ;
162
162
@@ -172,6 +172,14 @@ class Remangler {
172
172
// A callback for resolving symbolic references.
173
173
SymbolicResolver Resolver;
174
174
175
+ void addSubstWordsInIdent (const WordReplacement &repl) {
176
+ SubstWordsInIdent.push_back (repl, Factory);
177
+ }
178
+
179
+ void addWord (const SubstitutionWord &word) {
180
+ Words.push_back (word, Factory);
181
+ }
182
+
175
183
StringRef getBufferStr () const { return Buffer.getStringRef (); }
176
184
177
185
void resetBuffer (size_t toPos) { Buffer.resetSize (toPos); }
You can’t perform that action at this time.
0 commit comments