@@ -101,7 +101,7 @@ TokenSequence Definition::Tokenize(const std::vector<std::string> &argNames,
101101 continue ;
102102 }
103103 }
104- result.Put (token, firstToken + j, 1 );
104+ result.AppendRange (token, firstToken + j, 1 );
105105 }
106106 return result;
107107}
@@ -170,7 +170,7 @@ static TokenSequence TokenPasting(TokenSequence &&text) {
170170 }
171171 } else if (pasting && text.TokenAt (j).IsBlank ()) {
172172 } else {
173- result.Put (text, j, 1 );
173+ result.AppendRange (text, j, 1 );
174174 pasting = false ;
175175 }
176176 }
@@ -223,7 +223,7 @@ TokenSequence Definition::Apply(const std::vector<TokenSequence> &args,
223223 CHECK (resultSize > 0 &&
224224 result.TokenAt (resultSize - 1 ) == replacement_.TokenAt (prev - 1 ));
225225 result.pop_back ();
226- result.Put (Stringify (args[index], prescanner.allSources ()));
226+ result.CopyAll (Stringify (args[index], prescanner.allSources ()));
227227 } else {
228228 const TokenSequence *arg{&args[index]};
229229 std::optional<TokenSequence> replaced;
@@ -243,7 +243,7 @@ TokenSequence Definition::Apply(const std::vector<TokenSequence> &args,
243243 }
244244 }
245245 }
246- result.Put (DEREF (arg));
246+ result.CopyAll (DEREF (arg));
247247 }
248248 } else if (bytes == 11 && isVariadic_ &&
249249 token.ToString () == " __VA_ARGS__" ) {
@@ -254,7 +254,7 @@ TokenSequence Definition::Apply(const std::vector<TokenSequence> &args,
254254 if (k > argumentCount ()) {
255255 result.Put (" ," s, commaProvenance);
256256 }
257- result.Put (args[k]);
257+ result.CopyAll (args[k]);
258258 }
259259 } else if (bytes == 10 && isVariadic_ && token.ToString () == " __VA_OPT__" &&
260260 j + 2 < tokens && replacement_.TokenAt (j + 1 ).OnlyNonBlank () == ' (' &&
@@ -274,7 +274,7 @@ TokenSequence Definition::Apply(const std::vector<TokenSequence> &args,
274274 }
275275 }
276276 }
277- result.Put (replacement_, j);
277+ result.AppendRange (replacement_, j);
278278 }
279279 }
280280 return TokenPasting (std::move (result));
@@ -338,18 +338,18 @@ std::optional<TokenSequence> Preprocessor::MacroReplacement(
338338 inIfExpression](std::size_t after, const TokenSequence &replacement,
339339 std::size_t pFLMOffset) {
340340 if (after < input.SizeInTokens ()) {
341- result.Put (replacement, 0 , pFLMOffset);
341+ result.AppendRange (replacement, 0 , pFLMOffset);
342342 TokenSequence suffix;
343- suffix.Put (
343+ suffix.AppendRange (
344344 replacement, pFLMOffset, replacement.SizeInTokens () - pFLMOffset);
345- suffix.Put (input, after, input.SizeInTokens () - after);
345+ suffix.AppendRange (input, after, input.SizeInTokens () - after);
346346 auto further{ReplaceMacros (
347347 suffix, prescanner, partialFunctionLikeMacro, inIfExpression)};
348348 if (partialFunctionLikeMacro && *partialFunctionLikeMacro) {
349349 // still not closed
350350 **partialFunctionLikeMacro += result.SizeInTokens ();
351351 }
352- result.Put (further);
352+ result.CopyAll (further);
353353 return true ;
354354 } else {
355355 if (partialFunctionLikeMacro) {
@@ -362,7 +362,7 @@ std::optional<TokenSequence> Preprocessor::MacroReplacement(
362362 for (; j < tokens; ++j) {
363363 CharBlock token{input.TokenAt (j)};
364364 if (token.IsBlank () || !IsLegalIdentifierStart (token[0 ])) {
365- result.Put (input, j);
365+ result.AppendRange (input, j);
366366 continue ;
367367 }
368368 // Process identifier in replacement text.
@@ -388,12 +388,12 @@ std::optional<TokenSequence> Preprocessor::MacroReplacement(
388388 }
389389 }
390390 if (it == definitions_.end ()) {
391- result.Put (input, j);
391+ result.AppendRange (input, j);
392392 continue ;
393393 }
394394 Definition *def{&it->second };
395395 if (def->isDisabled ()) {
396- result.Put (input, j);
396+ result.AppendRange (input, j);
397397 continue ;
398398 }
399399 if (!def->isFunctionLike ()) {
@@ -444,7 +444,7 @@ std::optional<TokenSequence> Preprocessor::MacroReplacement(
444444 ProvenanceRange use{input.GetTokenProvenanceRange (j)};
445445 ProvenanceRange newRange{
446446 allSources_.AddMacroCall (from, use, replaced.ToString ())};
447- result.Put (replaced, newRange);
447+ result.CopyWithProvenance (replaced, newRange);
448448 }
449449 } else {
450450 // Possible function-like macro call. Skip spaces and newlines to see
@@ -461,10 +461,10 @@ std::optional<TokenSequence> Preprocessor::MacroReplacement(
461461 if (!leftParen) {
462462 if (partialFunctionLikeMacro) {
463463 *partialFunctionLikeMacro = result.SizeInTokens ();
464- result.Put (input, j, tokens - j);
464+ result.AppendRange (input, j, tokens - j);
465465 return result;
466466 } else {
467- result.Put (input, j);
467+ result.AppendRange (input, j);
468468 continue ;
469469 }
470470 }
@@ -491,11 +491,11 @@ std::optional<TokenSequence> Preprocessor::MacroReplacement(
491491 }
492492 if (k >= tokens && partialFunctionLikeMacro) {
493493 *partialFunctionLikeMacro = result.SizeInTokens ();
494- result.Put (input, j, tokens - j);
494+ result.AppendRange (input, j, tokens - j);
495495 return result;
496496 } else if (k >= tokens || argStart.size () < def->argumentCount () ||
497497 (argStart.size () > def->argumentCount () && !def->isVariadic ())) {
498- result.Put (input, j);
498+ result.AppendRange (input, j);
499499 continue ;
500500 }
501501 std::vector<TokenSequence> args;
@@ -520,7 +520,7 @@ std::optional<TokenSequence> Preprocessor::MacroReplacement(
520520 ProvenanceRange use{input.GetIntervalProvenanceRange (j, k - j)};
521521 ProvenanceRange newRange{
522522 allSources_.AddMacroCall (from, use, replaced.ToString ())};
523- result.Put (replaced, newRange);
523+ result.CopyWithProvenance (replaced, newRange);
524524 }
525525 j = k; // advance to the terminal ')'
526526 }
0 commit comments