mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:24:42 +01:00
Change StringLiteral to less frequently allocate a new string. (#3314)
Building on #3311, which started moving the result string into a `unique_ptr`, instead have `StringLiteral` use a `BumpPtrAllocator` to manage memory. But also, detect when a string is really trivial during `Lex` and, if so, return `contents_` directly.
This commit is contained in:
@@ -33,8 +33,9 @@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data,
|
||||
// Check multiline flag was computed correctly.
|
||||
CARBON_CHECK(token->is_multi_line() == token->text().contains('\n'));
|
||||
|
||||
llvm::BumpPtrAllocator allocator;
|
||||
volatile auto value =
|
||||
token->ComputeValue(NullDiagnosticEmitter<const char*>());
|
||||
token->ComputeValue(allocator, NullDiagnosticEmitter<const char*>());
|
||||
(void)value;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user