Commit 787dc636 authored by Nathan Bronson's avatar Nathan Bronson Committed by Facebook Github Bot

remove unnecessary folly:: qualification in F14

Summary: F14 code inside namespace folly doesn't need folly::

Reviewed By: yfeldblum

Differential Revision: D8772565

fbshipit-source-id: 720fa683b7ec9be9a096559191240ef7e672fe3e
parent c1c59c5b
......@@ -150,10 +150,8 @@ class F14BasicMap {
typename Policy::Hasher,
typename Policy::KeyEqual,
K>::value &&
!std::is_same<typename Policy::Iter, folly::remove_cvref_t<K>>::
value &&
!std::is_same<typename Policy::ConstIter, folly::remove_cvref_t<K>>::
value,
!std::is_same<typename Policy::Iter, remove_cvref_t<K>>::value &&
!std::is_same<typename Policy::ConstIter, remove_cvref_t<K>>::value,
T>;
public:
......@@ -497,7 +495,7 @@ class F14BasicMap {
std::piecewise_construct_t,
std::tuple<Args1...>&& first_args,
std::tuple<Args2...>&& second_args) {
auto key = folly::make_from_tuple<key_type>(
auto key = make_from_tuple<key_type>(
std::tuple<Args1&&...>(std::move(first_args)));
return table_.tryEmplaceValue(
key,
......@@ -1005,16 +1003,12 @@ class F14VectorMap
typename Policy::Hasher,
typename Policy::KeyEqual,
K>::value &&
!std::is_same<typename Policy::Iter, folly::remove_cvref_t<K>>::
!std::is_same<typename Policy::Iter, remove_cvref_t<K>>::value &&
!std::is_same<typename Policy::ConstIter, remove_cvref_t<K>>::value &&
!std::is_same<typename Policy::ReverseIter, remove_cvref_t<K>>::
value &&
!std::is_same<typename Policy::ConstIter, folly::remove_cvref_t<K>>::
value &&
!std::is_same<
typename Policy::ReverseIter,
folly::remove_cvref_t<K>>::value &&
!std::is_same<
typename Policy::ConstReverseIter,
folly::remove_cvref_t<K>>::value,
!std::is_same<typename Policy::ConstReverseIter, remove_cvref_t<K>>::
value,
T>;
public:
......@@ -1129,7 +1123,7 @@ class F14VectorMap
static_cast<uint32_t>(tailIndex)});
tail.item() = index;
auto p = std::addressof(values[index]);
folly::assume(p != nullptr);
assume(p != nullptr);
this->table_.transfer(a, std::addressof(values[tailIndex]), p, 1);
}
}
......
......@@ -146,7 +146,7 @@ class F14BasicSet {
typename Policy::Hasher,
typename Policy::KeyEqual,
K>::value &&
!std::is_same<typename Policy::Iter, folly::remove_cvref_t<K>>::value,
!std::is_same<typename Policy::Iter, remove_cvref_t<K>>::value,
T>;
public:
......@@ -797,11 +797,8 @@ class F14VectorSet
typename Policy::Hasher,
typename Policy::KeyEqual,
K>::value &&
!std::is_same<typename Policy::Iter, folly::remove_cvref_t<K>>::
value &&
!std::is_same<
typename Policy::ReverseIter,
folly::remove_cvref_t<K>>::value,
!std::is_same<typename Policy::Iter, remove_cvref_t<K>>::value &&
!std::is_same<typename Policy::ReverseIter, remove_cvref_t<K>>::value,
T>;
public:
......@@ -917,7 +914,7 @@ class F14VectorSet
static_cast<uint32_t>(tailIndex)});
tail.item() = index;
auto p = std::addressof(values[index]);
folly::assume(p != nullptr);
assume(p != nullptr);
this->table_.transfer(a, std::addressof(values[tailIndex]), p, 1);
}
}
......
......@@ -488,7 +488,7 @@ class ValueContainerPolicy : public BasePolicy<
static constexpr bool destroyItemOnClear() {
return !std::is_trivially_destructible<Item>::value ||
!folly::AllocatorHasDefaultObjectDestroy<Alloc, Item>::value;
!AllocatorHasDefaultObjectDestroy<Alloc, Item>::value;
}
// inherit constructors
......@@ -529,7 +529,7 @@ class ValueContainerPolicy : public BasePolicy<
void
constructValueAtItem(std::size_t /*size*/, Item* itemAddr, Args&&... args) {
Alloc& a = this->alloc();
folly::assume(itemAddr != nullptr);
assume(itemAddr != nullptr);
AllocTraits::construct(a, itemAddr, std::forward<Args>(args)...);
}
......@@ -556,7 +556,7 @@ class ValueContainerPolicy : public BasePolicy<
// location), but it seems highly likely that it will also cause
// the compiler to drop such assumptions that are violated due
// to our UB const_cast in moveValue.
destroyItem(*folly::launder(std::addressof(src)));
destroyItem(*launder(std::addressof(src)));
} else {
destroyItem(src);
}
......@@ -769,17 +769,17 @@ class NodeContainerPolicy
void
constructValueAtItem(std::size_t /*size*/, Item* itemAddr, Args&&... args) {
Alloc& a = this->alloc();
folly::assume(itemAddr != nullptr);
assume(itemAddr != nullptr);
new (itemAddr) Item{AllocTraits::allocate(a, 1)};
auto p = std::addressof(**itemAddr);
folly::assume(p != nullptr);
assume(p != nullptr);
AllocTraits::construct(a, p, std::forward<Args>(args)...);
}
void moveItemDuringRehash(Item* itemAddr, Item& src) {
// This is basically *itemAddr = src; src = nullptr, but allowing
// for fancy pointers.
folly::assume(itemAddr != nullptr);
assume(itemAddr != nullptr);
new (itemAddr) Item{std::move(src)};
src = nullptr;
src.~Item();
......@@ -985,10 +985,9 @@ class VectorContainerPolicy : public BasePolicy<
private:
static constexpr bool valueIsTriviallyCopyable() {
return folly::AllocatorHasDefaultObjectConstruct<Alloc, Value, Value>::
value &&
folly::AllocatorHasDefaultObjectDestroy<Alloc, Value>::value &&
folly::is_trivially_copyable<Value>::value;
return AllocatorHasDefaultObjectConstruct<Alloc, Value, Value>::value &&
AllocatorHasDefaultObjectDestroy<Alloc, Value>::value &&
is_trivially_copyable<Value>::value;
}
public:
......@@ -1139,10 +1138,10 @@ class VectorContainerPolicy : public BasePolicy<
std::memcpy(dst, src, n * sizeof(Value));
} else {
for (std::size_t i = 0; i < n; ++i, ++src, ++dst) {
folly::assume(dst != nullptr);
assume(dst != nullptr);
AllocTraits::construct(a, dst, Super::moveValue(*src));
if (kIsMap) {
AllocTraits::destroy(a, folly::launder(src));
AllocTraits::destroy(a, launder(src));
} else {
AllocTraits::destroy(a, src);
}
......@@ -1164,7 +1163,7 @@ class VectorContainerPolicy : public BasePolicy<
} else {
for (std::size_t i = 0; i < size; ++i, ++src, ++dst) {
try {
folly::assume(dst != nullptr);
assume(dst != nullptr);
AllocTraits::construct(a, dst, constructorArgFor(*src));
} catch (...) {
for (Value* cleanup = std::addressof(values_[0]); cleanup != dst;
......@@ -1347,8 +1346,8 @@ class VectorContainerPolicy : public BasePolicy<
if (underlying.atEnd()) {
return linearEnd();
} else {
folly::assume(values_ + underlying.item() != nullptr);
folly::assume(values_ != nullptr);
assume(values_ + underlying.item() != nullptr);
assume(values_ != nullptr);
return Iter{values_ + underlying.item(), values_};
}
}
......@@ -1359,7 +1358,7 @@ class VectorContainerPolicy : public BasePolicy<
Item iterToIndex(ConstIter const& iter) const {
auto n = iter.index();
folly::assume(n <= std::numeric_limits<Item>::max());
assume(n <= std::numeric_limits<Item>::max());
return static_cast<Item>(n);
}
......
......@@ -132,8 +132,7 @@ struct StdNodeReplica<
V,
H,
std::enable_if_t<
!StdIsFastHash<H>::value ||
!folly::is_nothrow_invocable<H, K>::value>> {
!StdIsFastHash<H>::value || !is_nothrow_invocable<H, K>::value>> {
void* next;
V value;
std::size_t hash;
......@@ -200,9 +199,8 @@ struct EligibleForHeterogeneousFind<
Hasher,
KeyEqual,
ArgKey,
folly::void_t<
typename Hasher::is_transparent,
typename KeyEqual::is_transparent>> : std::true_type {};
void_t<typename Hasher::is_transparent, typename KeyEqual::is_transparent>>
: std::true_type {};
template <
typename TableKey,
......@@ -221,7 +219,7 @@ template <
typename... KeyArgs>
using KeyTypeForEmplaceHelper = std::conditional_t<
sizeof...(KeyArgs) == 1 &&
(std::is_same<folly::remove_cvref_t<KeyArg0OrBool>, TableKey>::value ||
(std::is_same<remove_cvref_t<KeyArg0OrBool>, TableKey>::value ||
EligibleForHeterogeneousFind<
TableKey,
Hasher,
......@@ -258,7 +256,7 @@ FOLLY_ALWAYS_INLINE static void prefetchAddr(T const* ptr) {
template <typename T>
FOLLY_ALWAYS_INLINE static unsigned findFirstSetNonZero(T mask) {
folly::assume(mask != 0);
assume(mask != 0);
if (sizeof(mask) == sizeof(unsigned)) {
return __builtin_ctz(static_cast<unsigned>(mask));
} else {
......@@ -340,8 +338,7 @@ class DenseMaskIter {
if (mask == 0) {
count_ = 0;
} else {
count_ =
folly::popcount(static_cast<uint32_t>(((mask >> 32) << 2) | mask));
count_ = popcount(static_cast<uint32_t>(((mask >> 32) << 2) | mask));
if (LIKELY((mask & 1) != 0)) {
index_ = 0;
} else {
......@@ -458,8 +455,8 @@ class LastOccupiedInMask {
}
unsigned index() const {
folly::assume(mask_ != 0);
return (folly::findLastSet(mask_) - 1) / kMaskSpacing;
assume(mask_ != 0);
return (findLastSet(mask_) - 1) / kMaskSpacing;
}
};
......@@ -691,12 +688,12 @@ struct alignas(kRequiredVectorAlignment) F14Chunk {
Item& item(std::size_t i) {
FOLLY_SAFE_DCHECK(this->occupied(i), "");
return *folly::launder(itemAddr(i));
return *launder(itemAddr(i));
}
Item const& citem(std::size_t i) const {
FOLLY_SAFE_DCHECK(this->occupied(i), "");
return *folly::launder(itemAddr(i));
return *launder(itemAddr(i));
}
static F14Chunk& owner(Item& item, std::size_t index) {
......@@ -822,7 +819,7 @@ class PackedChunkItemPtr<T*> {
public:
PackedChunkItemPtr(T* p, std::size_t i) noexcept {
uintptr_t encoded = i >> (kIndexBits - kAlignBits);
folly::assume((encoded & ~kAlignMask) == 0);
assume((encoded & ~kAlignMask) == 0);
raw_ = reinterpret_cast<uintptr_t>(p) | encoded;
FOLLY_SAFE_DCHECK(p == ptr(), "");
FOLLY_SAFE_DCHECK(i == index(), "");
......@@ -879,10 +876,10 @@ class F14ItemIter {
: itemPtr_{std::pointer_traits<ItemPtr>::pointer_to(chunk->item(index))},
index_{index} {
FOLLY_SAFE_DCHECK(index < Chunk::kCapacity, "");
folly::assume(
assume(
std::pointer_traits<ItemPtr>::pointer_to(chunk->item(index)) !=
nullptr);
folly::assume(itemPtr_ != nullptr);
assume(itemPtr_ != nullptr);
}
FOLLY_ALWAYS_INLINE void advanceImpl(bool checkEof, bool likelyDead) {
......@@ -1020,11 +1017,11 @@ struct SizeAndPackedBegin<SizeType, ItemIter, false> {
SizeType size_{0};
[[noreturn]] typename ItemIter::Packed& packedBegin() {
folly::assume_unreachable();
assume_unreachable();
}
[[noreturn]] typename ItemIter::Packed const& packedBegin() const {
folly::assume_unreachable();
assume_unreachable();
}
};
......@@ -1529,7 +1526,7 @@ class F14Table : public Policy {
void insertAtBlank(ItemIter pos, HashPair hp, Args&&... args) {
try {
auto dst = pos.itemAddr();
folly::assume(dst != nullptr);
assume(dst != nullptr);
this->constructValueAtItem(size(), dst, std::forward<Args>(args)...);
} catch (...) {
eraseBlank(pos, hp);
......@@ -1595,8 +1592,8 @@ class F14Table : public Policy {
// partial failure should not occur. Sorry for the subtle invariants
// in the Policy API.
if (folly::is_trivially_copyable<Item>::value &&
!this->destroyItemOnClear() && bucket_count() == src.bucket_count()) {
if (is_trivially_copyable<Item>::value && !this->destroyItemOnClear() &&
bucket_count() == src.bucket_count()) {
// most happy path
auto n = chunkAllocSize(chunkMask_ + 1, bucket_count());
std::memcpy(&chunks_[0], &src.chunks_[0], n);
......@@ -1631,7 +1628,7 @@ class F14Table : public Policy {
auto&& srcArg =
std::forward<T>(src).buildArgForItem(srcChunk->item(srcI));
auto dst = dstChunk->itemAddr(dstI);
folly::assume(dst != nullptr);
assume(dst != nullptr);
this->constructValueAtItem(
0, dst, std::forward<decltype(srcArg)>(srcArg));
dstChunk->setTag(dstI, srcChunk->tag(srcI));
......@@ -2190,7 +2187,7 @@ class F14Table : public Policy {
F14TableStats computeStats() const {
F14TableStats stats;
if (folly::kIsDebug && Policy::kEnableItemIteration) {
if (kIsDebug && Policy::kEnableItemIteration) {
// validate iteration
std::size_t n = 0;
ItemIter prev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment