Skip to content
Merged
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
10 changes: 3 additions & 7 deletions llvm/include/llvm/ADT/SetVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class SetVector {
}

/// Check if the SetVector contains the given key.
bool contains(const key_type &key) const {
[[nodiscard]] bool contains(const key_type &key) const {
if constexpr (canBeSmall())
if (isSmall())
return is_contained(vector_, key);
Expand All @@ -271,12 +271,8 @@ class SetVector {

/// Count the number of elements of a given key in the SetVector.
/// \returns 0 if the element is not in the SetVector, 1 if it is.
size_type count(const key_type &key) const {
if constexpr (canBeSmall())
if (isSmall())
return is_contained(vector_, key);

return set_.count(key);
[[nodiscard]] size_type count(const key_type &key) const {
return contains(key) ? 1 : 0;
}

/// Completely clear the SetVector
Expand Down
Loading