Skip to content

[libc] remove BlockStore from cpp namespace #85312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions libc/src/__support/blockstore.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <stdint.h>

namespace LIBC_NAMESPACE {
namespace cpp {

// The difference between BlockStore a traditional vector types is that,
// when more capacity is desired, a new block is added instead of allocating
Expand Down Expand Up @@ -203,7 +202,6 @@ void BlockStore<T, BLOCK_SIZE, REVERSE_ORDER>::destroy(
template <typename T, size_t BLOCK_SIZE>
using ReverseOrderBlockStore = BlockStore<T, BLOCK_SIZE, true>;

} // namespace cpp
} // namespace LIBC_NAMESPACE

#endif // LLVM_LIBC_SRC___SUPPORT_BLOCKSTORE_H
2 changes: 1 addition & 1 deletion libc/src/stdlib/atexit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct AtExitUnit {
// mutexes simply passthrough. We will need a lock free stack.
using ExitCallbackList = FixedVector<AtExitUnit, 64>;
#elif defined(LIBC_COPT_PUBLIC_PACKAGING)
using ExitCallbackList = cpp::ReverseOrderBlockStore<AtExitUnit, 32>;
using ExitCallbackList = ReverseOrderBlockStore<AtExitUnit, 32>;
#else
// BlockStore uses dynamic memory allocation. To avoid dynamic memory
// allocation in tests, we use a fixed size callback list when built for
Expand Down
8 changes: 4 additions & 4 deletions libc/test/src/__support/blockstore_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class LlvmLibcBlockStoreTest : public LIBC_NAMESPACE::testing::Test {
public:
template <size_t BLOCK_SIZE, size_t ELEMENT_COUNT, bool REVERSE>
void populate_and_iterate() {
LIBC_NAMESPACE::cpp::BlockStore<Element, BLOCK_SIZE, REVERSE> block_store;
LIBC_NAMESPACE::BlockStore<Element, BLOCK_SIZE, REVERSE> block_store;
for (int i = 0; i < int(ELEMENT_COUNT); ++i)
ASSERT_TRUE(block_store.push_back({i, 2 * i, 3 * unsigned(i)}));
auto end = block_store.end();
Expand All @@ -38,12 +38,12 @@ class LlvmLibcBlockStoreTest : public LIBC_NAMESPACE::testing::Test {
}
}
ASSERT_EQ(i, int(ELEMENT_COUNT));
LIBC_NAMESPACE::cpp::BlockStore<Element, BLOCK_SIZE, REVERSE>::destroy(
LIBC_NAMESPACE::BlockStore<Element, BLOCK_SIZE, REVERSE>::destroy(
&block_store);
}

template <bool REVERSE> void back_test() {
using LIBC_NAMESPACE::cpp::BlockStore;
using LIBC_NAMESPACE::BlockStore;
BlockStore<int, 4, REVERSE> block_store;
for (int i = 0; i < 20; i++)
ASSERT_TRUE(block_store.push_back(i));
Expand All @@ -53,7 +53,7 @@ class LlvmLibcBlockStoreTest : public LIBC_NAMESPACE::testing::Test {
}

template <bool REVERSE> void empty_test() {
using LIBC_NAMESPACE::cpp::BlockStore;
using LIBC_NAMESPACE::BlockStore;
BlockStore<int, 2, REVERSE> block_store;

ASSERT_TRUE(block_store.empty());
Expand Down