Skip to content

Commit

Permalink
[clangd] NFC: mark single-parameter constructors explicit
Browse files Browse the repository at this point in the history
Code health: prevent implicit conversions to user-defined types.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D51690

llvm-svn: 341543
  • Loading branch information
kirillbobyrev committed Sep 6, 2018
1 parent 19a9461 commit e4ee021
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions clang-tools-extra/clangd/index/dex/Iterator.cpp
Expand Up @@ -23,7 +23,7 @@ namespace {
/// tree) and is simply a wrapper around PostingList::const_iterator.
class DocumentIterator : public Iterator {
public:
DocumentIterator(PostingListRef Documents)
explicit DocumentIterator(PostingListRef Documents)
: Documents(Documents), Index(std::begin(Documents)) {}

bool reachedEnd() const override { return Index == std::end(Documents); }
Expand Down Expand Up @@ -85,7 +85,7 @@ class DocumentIterator : public Iterator {
/// iterator restores the invariant: all children must point to the same item.
class AndIterator : public Iterator {
public:
AndIterator(std::vector<std::unique_ptr<Iterator>> AllChildren)
explicit AndIterator(std::vector<std::unique_ptr<Iterator>> AllChildren)
: Children(std::move(AllChildren)) {
assert(!Children.empty() && "AND iterator should have at least one child.");
// Establish invariants.
Expand Down Expand Up @@ -193,7 +193,7 @@ class AndIterator : public Iterator {
/// soon as all of its children are exhausted.
class OrIterator : public Iterator {
public:
OrIterator(std::vector<std::unique_ptr<Iterator>> AllChildren)
explicit OrIterator(std::vector<std::unique_ptr<Iterator>> AllChildren)
: Children(std::move(AllChildren)) {
assert(Children.size() > 0 && "OR iterator must have at least one child.");
}
Expand Down Expand Up @@ -279,7 +279,7 @@ class OrIterator : public Iterator {
/// in O(1).
class TrueIterator : public Iterator {
public:
TrueIterator(DocID Size) : Size(Size) {}
explicit TrueIterator(DocID Size) : Size(Size) {}

bool reachedEnd() const override { return Index >= Size; }

Expand Down

0 comments on commit e4ee021

Please sign in to comment.