mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-08 13:14:56 +00:00
Add tint::BlockAllocator<T>
A container and allocator of objects of (or deriving from) the template type `T`. Objects are allocated by calling Create(), and are owned by the BlockAllocator. When the BlockAllocator is destructed, all constructed objects are automatically destructed and freed. Objects held by the BlockAllocator can be iterated over using a View or ConstView. Use this to hold the ast::Nodes in the ast::Module This is called BlockAllocator as it can be optimized to hold objects in contiguous memory blocks, which will improve cache coherencey. Currently BlockAllocator is a straight port of the vector-of-unique-ptr, taken from ast::Module. Change-Id: I4bf4d298aec3c70d2ddf833e2f168416cbb024c0 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38001 Reviewed-by: dan sinclair <dsinclair@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
e1abcb4564
commit
587f387fd9
@@ -64,15 +64,15 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
|
||||
// Check that none of the AST nodes or type pointers in dst are found in src
|
||||
std::unordered_set<tint::ast::Node*> src_nodes;
|
||||
for (auto& src_node : src.nodes()) {
|
||||
src_nodes.emplace(src_node.get());
|
||||
for (auto* src_node : src.nodes()) {
|
||||
src_nodes.emplace(src_node);
|
||||
}
|
||||
std::unordered_set<tint::ast::type::Type*> src_types;
|
||||
for (auto& src_type : src.types()) {
|
||||
src_types.emplace(src_type.second.get());
|
||||
}
|
||||
for (auto& dst_node : dst.nodes()) {
|
||||
ASSERT_EQ(src_nodes.count(dst_node.get()), 0u);
|
||||
for (auto* dst_node : dst.nodes()) {
|
||||
ASSERT_EQ(src_nodes.count(dst_node), 0u);
|
||||
}
|
||||
for (auto& dst_type : dst.types()) {
|
||||
ASSERT_EQ(src_types.count(dst_type.second.get()), 0u);
|
||||
|
||||
Reference in New Issue
Block a user