mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-19 04:50:28 +00:00
Switch to BumpPtrAllocator for C-string storage (#6550)
This keeps the allocations cheap and simplifies the code. It was inspired by the need to expand param files, but no functionality changed yet.
This commit is contained in:
1 parent
505b1c86b9
commit
eecbb7e508
7 files changed
+34
-44
No files matched your search
@@ -15,6 +15,7 @@
|
||||
#include "lld/Common/Driver.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
|
||||
namespace Carbon {
|
||||
|
||||
@@ -24,9 +25,9 @@ auto LLVMRunner::Run(LLVMTool tool, llvm::ArrayRef<llvm::StringRef> args)
|
||||
|
||||
// Allocate one chunk of storage for the actual C-strings and a vector of
|
||||
// pointers into the storage.
|
||||
llvm::OwningArrayRef<char> cstr_arg_storage;
|
||||
llvm::BumpPtrAllocator alloc;
|
||||
llvm::SmallVector<const char*, 64> cstr_args =
|
||||
BuildCStrArgs(path, args, cstr_arg_storage);
|
||||
BuildCStrArgs(path, args, alloc);
|
||||
|
||||
CARBON_VLOG("Running LLVM's {0} tool with args:\n", tool.name());
|
||||
for (const char* cstr_arg : cstr_args) {
|
||||
|
||||
Reference in new issue
Block a user