Merge pull request #24873 from veblush/tidy-google-explicit-constructor

[Clang-Tidy] google-explicit-constructor
pull/24900/head
Esun Kim 4 years ago committed by GitHub
commit d0f0aac905
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .clang-tidy
  2. 2
      src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc
  3. 2
      src/core/ext/transport/chttp2/transport/flow_control.h
  4. 2
      src/core/ext/transport/chttp2/transport/writing.cc
  5. 4
      src/core/ext/transport/cronet/transport/cronet_transport.cc
  6. 2
      src/core/lib/channel/channel_trace.h
  7. 4
      src/core/lib/gprpp/ref_counted.h
  8. 10
      src/core/lib/gprpp/ref_counted_ptr.h
  9. 2
      src/core/lib/http/httpcli_security_connector.cc
  10. 6
      src/core/lib/iomgr/exec_ctx.h
  11. 2
      src/core/lib/iomgr/executor.h
  12. 2
      src/core/lib/iomgr/executor/threadpool.h
  13. 2
      src/core/lib/iomgr/poller/eventmanager_libuv.h
  14. 5
      src/core/lib/iomgr/tcp_posix.cc
  15. 10
      src/core/lib/json/json.h
  16. 5
      src/core/lib/security/credentials/oauth2/oauth2_credentials.h
  17. 2
      src/core/lib/security/credentials/ssl/ssl_credentials.h
  18. 2
      src/core/lib/security/security_connector/alts/alts_security_connector.cc
  19. 2
      src/core/lib/security/security_connector/fake/fake_security_connector.cc
  20. 2
      src/core/lib/security/security_connector/insecure/insecure_security_connector.h
  21. 2
      src/core/lib/security/security_connector/local/local_security_connector.cc
  22. 2
      src/core/lib/security/security_connector/ssl/ssl_security_connector.cc
  23. 2
      src/core/lib/slice/slice_internal.h
  24. 2
      src/core/lib/surface/call.cc
  25. 8
      src/core/lib/surface/completion_queue.cc
  26. 6
      src/core/lib/transport/connectivity_state.h
  27. 2
      src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc
  28. 2
      src/cpp/server/dynamic_thread_pool.h
  29. 2
      src/cpp/server/secure_server_credentials.h
  30. 4
      src/cpp/server/server_cc.cc
  31. 2
      src/cpp/thread_manager/thread_manager.h
  32. 2
      test/core/channel/channel_trace_test.cc
  33. 2
      test/core/channel/channelz_test.cc
  34. 2
      test/core/client_channel/service_config_test.cc
  35. 4
      test/core/iomgr/mpmcqueue_test.cc
  36. 9
      test/core/iomgr/poller/eventmanager_libuv_test.cc
  37. 2
      test/core/surface/completion_queue_test.cc
  38. 2
      test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc
  39. 2
      test/core/xds/xds_bootstrap_test.cc
  40. 7
      test/cpp/end2end/client_callback_end2end_test.cc
  41. 16
      test/cpp/end2end/client_interceptors_end2end_test.cc
  42. 3
      test/cpp/end2end/delegating_channel_test.cc
  43. 8
      test/cpp/end2end/end2end_test.cc
  44. 6
      test/cpp/end2end/server_interceptors_end2end_test.cc
  45. 2
      test/cpp/end2end/xds_end2end_test.cc
  46. 6
      test/cpp/interop/client_helper.h
  47. 2
      test/cpp/interop/http2_client.h
  48. 2
      test/cpp/interop/server_helper.h
  49. 3
      test/cpp/interop/stress_interop_client.h
  50. 2
      test/cpp/interop/xds_interop_server.cc
  51. 2
      test/cpp/microbenchmarks/bm_call_create.cc
  52. 4
      test/cpp/microbenchmarks/bm_chttp2_transport.cc
  53. 4
      test/cpp/microbenchmarks/bm_threadpool.cc
  54. 7
      test/cpp/microbenchmarks/fullstack_context_mutators.h
  55. 30
      test/cpp/microbenchmarks/fullstack_fixtures.h
  56. 13
      test/cpp/qps/client_callback.cc
  57. 14
      test/cpp/qps/client_sync.cc
  58. 2
      test/cpp/qps/qps_worker.cc
  59. 4
      test/cpp/qps/report.h
  60. 3
      test/cpp/server/server_builder_with_socket_mutator_test.cc
  61. 2
      test/cpp/util/grpc_tool_test.cc
  62. 2
      test/cpp/util/subprocess.h

@ -10,7 +10,6 @@ Checks: '-*,
-performance-unnecessary-copy-initialization,
-performance-unnecessary-value-param,
google-*,
-google-explicit-constructor,
-google-runtime-int,
-google-runtime-references,
misc-definitions-in-headers,

@ -55,7 +55,7 @@ class XdsClusterManagerLbConfig : public LoadBalancingPolicy::Config {
using ClusterMap =
std::map<std::string, RefCountedPtr<LoadBalancingPolicy::Config>>;
XdsClusterManagerLbConfig(ClusterMap cluster_map)
explicit XdsClusterManagerLbConfig(ClusterMap cluster_map)
: cluster_map_(std::move(cluster_map)) {}
const char* name() const override { return kXdsClusterManager; }

@ -201,7 +201,7 @@ class TransportFlowControlBase {
class TransportFlowControlDisabled final : public TransportFlowControlBase {
public:
// Maxes out all values
TransportFlowControlDisabled(grpc_chttp2_transport* t);
explicit TransportFlowControlDisabled(grpc_chttp2_transport* t);
bool flow_control_enabled() const override { return false; }

@ -198,7 +198,7 @@ class StreamWriteContext;
class WriteContext {
public:
WriteContext(grpc_chttp2_transport* t) : t_(t) {
explicit WriteContext(grpc_chttp2_transport* t) : t_(t) {
GRPC_STATS_INC_HTTP2_WRITES_BEGUN();
GPR_TIMER_SCOPE("grpc_chttp2_begin_write", 0);
}

@ -117,7 +117,7 @@ typedef struct grpc_cronet_transport grpc_cronet_transport;
/* TODO (makdharma): reorder structure for memory efficiency per
http://www.catb.org/esr/structure-packing/#_structure_reordering: */
struct read_state {
read_state(grpc_core::Arena* arena)
explicit read_state(grpc_core::Arena* arena)
: trailing_metadata(arena), initial_metadata(arena) {
grpc_slice_buffer_init(&read_slice_buffer);
}
@ -151,7 +151,7 @@ struct write_state {
/* track state of one stream op */
struct op_state {
op_state(grpc_core::Arena* arena) : rs(arena) {}
explicit op_state(grpc_core::Arena* arena) : rs(arena) {}
bool state_op_done[OP_NUM_OPS] = {};
bool state_callback_received[OP_NUM_OPS] = {};

@ -41,7 +41,7 @@ class BaseNode;
// https://github.com/grpc/proposal/blob/master/A14-channelz.md
class ChannelTrace {
public:
ChannelTrace(size_t max_event_memory);
explicit ChannelTrace(size_t max_event_memory);
~ChannelTrace();
enum Severity {

@ -221,12 +221,12 @@ class Delete;
template <typename T>
class Delete<T, true> {
public:
Delete(T* t) { delete t; }
explicit Delete(T* t) { delete t; }
};
template <typename T>
class Delete<T, false> {
public:
Delete(T* t) {}
explicit Delete(T* t) {}
};
} // namespace internal

@ -35,10 +35,12 @@ template <typename T>
class RefCountedPtr {
public:
RefCountedPtr() {}
// NOLINTNEXTLINE(google-explicit-constructor)
RefCountedPtr(std::nullptr_t) {}
// If value is non-null, we take ownership of a ref to it.
template <typename Y>
// NOLINTNEXTLINE(google-explicit-constructor)
RefCountedPtr(Y* value) : value_(value) {}
// Move ctors.
@ -47,6 +49,7 @@ class RefCountedPtr {
other.value_ = nullptr;
}
template <typename Y>
// NOLINTNEXTLINE(google-explicit-constructor)
RefCountedPtr(RefCountedPtr<Y>&& other) noexcept {
value_ = static_cast<T*>(other.value_);
other.value_ = nullptr;
@ -71,6 +74,7 @@ class RefCountedPtr {
value_ = other.value_;
}
template <typename Y>
// NOLINTNEXTLINE(google-explicit-constructor)
RefCountedPtr(const RefCountedPtr<Y>& other) {
static_assert(std::has_virtual_destructor<T>::value,
"T does not have a virtual dtor");
@ -181,11 +185,13 @@ template <typename T>
class WeakRefCountedPtr {
public:
WeakRefCountedPtr() {}
// NOLINTNEXTLINE(google-explicit-constructor)
WeakRefCountedPtr(std::nullptr_t) {}
// If value is non-null, we take ownership of a ref to it.
template <typename Y>
explicit WeakRefCountedPtr(Y* value) {
// NOLINTNEXTLINE(google-explicit-constructor)
WeakRefCountedPtr(Y* value) {
value_ = value;
}
@ -195,6 +201,7 @@ class WeakRefCountedPtr {
other.value_ = nullptr;
}
template <typename Y>
// NOLINTNEXTLINE(google-explicit-constructor)
WeakRefCountedPtr(WeakRefCountedPtr<Y>&& other) noexcept {
value_ = static_cast<T*>(other.value_);
other.value_ = nullptr;
@ -219,6 +226,7 @@ class WeakRefCountedPtr {
value_ = other.value_;
}
template <typename Y>
// NOLINTNEXTLINE(google-explicit-constructor)
WeakRefCountedPtr(const WeakRefCountedPtr<Y>& other) {
static_assert(std::has_virtual_destructor<T>::value,
"T does not have a virtual dtor");

@ -43,7 +43,7 @@
class grpc_httpcli_ssl_channel_security_connector final
: public grpc_channel_security_connector {
public:
grpc_httpcli_ssl_channel_security_connector(char* secure_peer_name)
explicit grpc_httpcli_ssl_channel_security_connector(char* secure_peer_name)
: grpc_channel_security_connector(
/*url_scheme=*/nullptr,
/*channel_creds=*/nullptr,

@ -113,7 +113,7 @@ class ExecCtx {
}
/** Parameterised Constructor */
ExecCtx(uintptr_t fl) : flags_(fl) {
explicit ExecCtx(uintptr_t fl) : flags_(fl) {
if (!(GRPC_EXEC_CTX_FLAG_IS_INTERNAL_THREAD & flags_)) {
grpc_core::Fork::IncExecCtxCount();
}
@ -308,7 +308,9 @@ class ApplicationCallbackExecCtx {
ApplicationCallbackExecCtx() { Set(this, flags_); }
/** Parameterised Constructor */
ApplicationCallbackExecCtx(uintptr_t fl) : flags_(fl) { Set(this, flags_); }
explicit ApplicationCallbackExecCtx(uintptr_t fl) : flags_(fl) {
Set(this, flags_);
}
~ApplicationCallbackExecCtx() {
if (reinterpret_cast<ApplicationCallbackExecCtx*>(

@ -54,7 +54,7 @@ enum class ExecutorJobType {
class Executor {
public:
Executor(const char* executor_name);
explicit Executor(const char* executor_name);
void Init();

@ -99,7 +99,7 @@ class ThreadPool : public ThreadPoolInterface {
// Creates a thread pool with size of "num_threads", with default thread name
// "ThreadPoolWorker" and all thread options set to default. If the given size
// is 0 or less, there will be 1 worker thread created inside pool.
ThreadPool(int num_threads);
explicit ThreadPool(int num_threads);
// Same as ThreadPool(int num_threads) constructor, except
// that it also sets "thd_name" as the name of all threads in the thread pool.

@ -36,7 +36,7 @@ class LibuvEventManager {
class Options {
public:
Options();
Options(int num_workers);
explicit Options(int num_workers);
int num_workers() const { return num_workers_; }
void set_num_workers(int num) { num_workers_ = num; }

@ -181,8 +181,9 @@ class TcpZerocopySendCtx {
static constexpr int kDefaultMaxSends = 4;
static constexpr size_t kDefaultSendBytesThreshold = 16 * 1024; // 16KB
TcpZerocopySendCtx(int max_sends = kDefaultMaxSends,
size_t send_bytes_threshold = kDefaultSendBytesThreshold)
explicit TcpZerocopySendCtx(
int max_sends = kDefaultMaxSends,
size_t send_bytes_threshold = kDefaultSendBytesThreshold)
: max_sends_(max_sends),
free_send_records_size_(max_sends),
threshold_bytes_(send_bytes_threshold) {

@ -76,6 +76,7 @@ class Json {
// Construct from copying a string.
// If is_number is true, the type will be NUMBER instead of STRING.
// NOLINTNEXTLINE(google-explicit-constructor)
Json(const std::string& string, bool is_number = false)
: type_(is_number ? Type::NUMBER : Type::STRING), string_value_(string) {}
Json& operator=(const std::string& string) {
@ -85,12 +86,14 @@ class Json {
}
// Same thing for C-style strings, both const and mutable.
// NOLINTNEXTLINE(google-explicit-constructor)
Json(const char* string, bool is_number = false)
: Json(std::string(string), is_number) {}
Json& operator=(const char* string) {
*this = std::string(string);
return *this;
}
// NOLINTNEXTLINE(google-explicit-constructor)
Json(char* string, bool is_number = false)
: Json(std::string(string), is_number) {}
Json& operator=(char* string) {
@ -99,6 +102,7 @@ class Json {
}
// Construct by moving a string.
// NOLINTNEXTLINE(google-explicit-constructor)
Json(std::string&& string)
: type_(Type::STRING), string_value_(std::move(string)) {}
Json& operator=(std::string&& string) {
@ -108,6 +112,7 @@ class Json {
}
// Construct from bool.
// NOLINTNEXTLINE(google-explicit-constructor)
Json(bool b) : type_(b ? Type::JSON_TRUE : Type::JSON_FALSE) {}
Json& operator=(bool b) {
type_ = b ? Type::JSON_TRUE : Type::JSON_FALSE;
@ -116,6 +121,7 @@ class Json {
// Construct from any numeric type.
template <typename NumericType>
// NOLINTNEXTLINE(google-explicit-constructor)
Json(NumericType number)
: type_(Type::NUMBER), string_value_(std::to_string(number)) {}
template <typename NumericType>
@ -126,6 +132,7 @@ class Json {
}
// Construct by copying object.
// NOLINTNEXTLINE(google-explicit-constructor)
Json(const Object& object) : type_(Type::OBJECT), object_value_(object) {}
Json& operator=(const Object& object) {
type_ = Type::OBJECT;
@ -134,6 +141,7 @@ class Json {
}
// Construct by moving object.
// NOLINTNEXTLINE(google-explicit-constructor)
Json(Object&& object)
: type_(Type::OBJECT), object_value_(std::move(object)) {}
Json& operator=(Object&& object) {
@ -143,6 +151,7 @@ class Json {
}
// Construct by copying array.
// NOLINTNEXTLINE(google-explicit-constructor)
Json(const Array& array) : type_(Type::ARRAY), array_value_(array) {}
Json& operator=(const Array& array) {
type_ = Type::ARRAY;
@ -151,6 +160,7 @@ class Json {
}
// Construct by moving array.
// NOLINTNEXTLINE(google-explicit-constructor)
Json(Array&& array) : type_(Type::ARRAY), array_value_(std::move(array)) {}
Json& operator=(Array&& array) {
type_ = Type::ARRAY;

@ -107,7 +107,8 @@ class grpc_oauth2_token_fetcher_credentials : public grpc_call_credentials {
class grpc_google_refresh_token_credentials final
: public grpc_oauth2_token_fetcher_credentials {
public:
grpc_google_refresh_token_credentials(grpc_auth_refresh_token refresh_token);
explicit grpc_google_refresh_token_credentials(
grpc_auth_refresh_token refresh_token);
~grpc_google_refresh_token_credentials() override;
const grpc_auth_refresh_token& refresh_token() const {
@ -130,7 +131,7 @@ class grpc_google_refresh_token_credentials final
// Access token credentials.
class grpc_access_token_credentials final : public grpc_call_credentials {
public:
grpc_access_token_credentials(const char* access_token);
explicit grpc_access_token_credentials(const char* access_token);
~grpc_access_token_credentials() override;
bool get_request_metadata(grpc_polling_entity* pollent,

@ -64,7 +64,7 @@ struct grpc_ssl_server_certificate_config_fetcher {
class grpc_ssl_server_credentials final : public grpc_server_credentials {
public:
grpc_ssl_server_credentials(
explicit grpc_ssl_server_credentials(
const grpc_ssl_server_credentials_options& options);
~grpc_ssl_server_credentials() override;

@ -134,7 +134,7 @@ class grpc_alts_channel_security_connector final
class grpc_alts_server_security_connector final
: public grpc_server_security_connector {
public:
grpc_alts_server_security_connector(
explicit grpc_alts_server_security_connector(
grpc_core::RefCountedPtr<grpc_server_credentials> server_creds)
: grpc_server_security_connector(GRPC_ALTS_URL_SCHEME,
std::move(server_creds)) {}

@ -275,7 +275,7 @@ void grpc_fake_channel_security_connector::check_peer(
class grpc_fake_server_security_connector
: public grpc_server_security_connector {
public:
grpc_fake_server_security_connector(
explicit grpc_fake_server_security_connector(
grpc_core::RefCountedPtr<grpc_server_credentials> server_creds)
: grpc_server_security_connector(GRPC_FAKE_SECURITY_URL_SCHEME,
std::move(server_creds)) {}

@ -65,7 +65,7 @@ class InsecureChannelSecurityConnector
class InsecureServerSecurityConnector : public grpc_server_security_connector {
public:
InsecureServerSecurityConnector(
explicit InsecureServerSecurityConnector(
grpc_core::RefCountedPtr<grpc_server_credentials> server_creds)
: grpc_server_security_connector(nullptr /* url_scheme */,
std::move(server_creds)) {}

@ -206,7 +206,7 @@ class grpc_local_channel_security_connector final
class grpc_local_server_security_connector final
: public grpc_server_security_connector {
public:
grpc_local_server_security_connector(
explicit grpc_local_server_security_connector(
grpc_core::RefCountedPtr<grpc_server_credentials> server_creds)
: grpc_server_security_connector(nullptr, std::move(server_creds)) {}
~grpc_local_server_security_connector() override = default;

@ -206,7 +206,7 @@ class grpc_ssl_channel_security_connector final
class grpc_ssl_server_security_connector
: public grpc_server_security_connector {
public:
grpc_ssl_server_security_connector(
explicit grpc_ssl_server_security_connector(
grpc_core::RefCountedPtr<grpc_server_credentials> server_creds)
: grpc_server_security_connector(GRPC_SSL_URL_SCHEME,
std::move(server_creds)) {}

@ -176,7 +176,7 @@ namespace grpc_core {
struct StaticSliceRefcount {
static grpc_slice_refcount kStaticSubRefcount;
StaticSliceRefcount(uint32_t index)
explicit StaticSliceRefcount(uint32_t index)
: base(&kStaticSubRefcount, grpc_slice_refcount::Type::STATIC),
index(index) {}

@ -124,7 +124,7 @@ struct parent_call {
};
struct child_call {
child_call(grpc_call* parent) : parent(parent) {}
explicit child_call(grpc_call* parent) : parent(parent) {}
grpc_call* parent;
/** siblings: children of the same parent form a list, and this list is
protected under

@ -310,7 +310,7 @@ struct cq_pluck_data {
};
struct cq_callback_data {
cq_callback_data(
explicit cq_callback_data(
grpc_experimental_completion_queue_functor* shutdown_callback)
: shutdown_callback(shutdown_callback) {}
@ -913,7 +913,8 @@ struct cq_is_finished_arg {
};
class ExecCtxNext : public grpc_core::ExecCtx {
public:
ExecCtxNext(void* arg) : ExecCtx(0), check_ready_to_finish_arg_(arg) {}
explicit ExecCtxNext(void* arg)
: ExecCtx(0), check_ready_to_finish_arg_(arg) {}
bool CheckReadyToFinish() override {
cq_is_finished_arg* a =
@ -1161,7 +1162,8 @@ static void del_plucker(grpc_completion_queue* cq, void* tag,
class ExecCtxPluck : public grpc_core::ExecCtx {
public:
ExecCtxPluck(void* arg) : ExecCtx(0), check_ready_to_finish_arg_(arg) {}
explicit ExecCtxPluck(void* arg)
: ExecCtx(0), check_ready_to_finish_arg_(arg) {}
bool CheckReadyToFinish() override {
cq_is_finished_arg* a =

@ -95,9 +95,9 @@ class AsyncConnectivityStateWatcherInterface
// to be called).
class ConnectivityStateTracker {
public:
ConnectivityStateTracker(const char* name,
grpc_connectivity_state state = GRPC_CHANNEL_IDLE,
const absl::Status& status = absl::Status())
explicit ConnectivityStateTracker(
const char* name, grpc_connectivity_state state = GRPC_CHANNEL_IDLE,
const absl::Status& status = absl::Status())
: name_(name), state_(state), status_(status) {}
~ConnectivityStateTracker();

@ -32,7 +32,7 @@ namespace {
class BoringSslCachedSession : public SslCachedSession {
public:
BoringSslCachedSession(SslSessionPtr session)
explicit BoringSslCachedSession(SslSessionPtr session)
: session_(std::move(session)) {}
SslSessionPtr CopySession() const override {

@ -41,7 +41,7 @@ class DynamicThreadPool final : public ThreadPoolInterface {
private:
class DynamicThread {
public:
DynamicThread(DynamicThreadPool* pool);
explicit DynamicThread(DynamicThreadPool* pool);
~DynamicThread();
private:

@ -40,7 +40,7 @@ class AuthMetadataProcessorAyncWrapper final {
const grpc_metadata* md, size_t num_md,
grpc_process_auth_metadata_done_cb cb, void* user_data);
AuthMetadataProcessorAyncWrapper(
explicit AuthMetadataProcessorAyncWrapper(
const std::shared_ptr<AuthMetadataProcessor>& processor)
: processor_(processor) {
if (processor && processor->IsBlocking()) {

@ -315,7 +315,7 @@ class Server::UnimplementedAsyncResponse final
grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpServerSendStatus> {
public:
UnimplementedAsyncResponse(UnimplementedAsyncRequest* request);
explicit UnimplementedAsyncResponse(UnimplementedAsyncRequest* request);
~UnimplementedAsyncResponse() override { delete request_; }
bool FinalizeResult(void** tag, bool* status) override {
@ -592,7 +592,7 @@ class Server::CallbackRequest final
class CallbackCallTag : public grpc_experimental_completion_queue_functor {
public:
CallbackCallTag(Server::CallbackRequest<ServerContextType>* req)
explicit CallbackCallTag(Server::CallbackRequest<ServerContextType>* req)
: req_(req) {
functor_run = &CallbackCallTag::StaticRun;
// Set inlineable to true since this callback is internally-controlled

@ -119,7 +119,7 @@ class ThreadManager {
// not be called (and the need for this WorkerThread class is eliminated)
class WorkerThread {
public:
WorkerThread(ThreadManager* thd_mgr);
explicit WorkerThread(ThreadManager* thd_mgr);
~WorkerThread();
bool created() const { return created_; }

@ -102,7 +102,7 @@ void ValidateChannelTrace(ChannelTrace* tracer, size_t num_events_logged) {
class ChannelFixture {
public:
ChannelFixture(int max_tracer_event_memory) {
explicit ChannelFixture(int max_tracer_event_memory) {
grpc_arg client_a = grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE),
max_tracer_event_memory);

@ -143,7 +143,7 @@ void ValidateGetServers(size_t expected_servers) {
class ChannelFixture {
public:
ChannelFixture(int max_tracer_event_memory = 0) {
explicit ChannelFixture(int max_tracer_event_memory = 0) {
grpc_arg client_a[] = {
grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE),

@ -38,7 +38,7 @@ namespace testing {
class TestParsedConfig1 : public ServiceConfigParser::ParsedConfig {
public:
TestParsedConfig1(int value) : value_(value) {}
explicit TestParsedConfig1(int value) : value_(value) {}
int value() const { return value_; }

@ -30,7 +30,7 @@ struct WorkItem {
int index;
bool done;
WorkItem(int i) : index(i) { done = false; }
explicit WorkItem(int i) : index(i) { done = false; }
};
// Thread to "produce" items and put items into queue
@ -77,7 +77,7 @@ class ProducerThread {
// Thread to pull out items from queue
class ConsumerThread {
public:
ConsumerThread(grpc_core::InfLenFIFOQueue* queue) : queue_(queue) {
explicit ConsumerThread(grpc_core::InfLenFIFOQueue* queue) : queue_(queue) {
thd_ = grpc_core::Thread(
"mpmcq_test_consumer_thd",
[](void* th) { static_cast<ConsumerThread*>(th)->Run(); }, this);

@ -32,7 +32,8 @@ namespace {
TEST(LibuvEventManager, Allocation) {
for (int i = 0; i < 10; i++) {
LibuvEventManager* em = new LibuvEventManager(i);
LibuvEventManager* em =
new LibuvEventManager(LibuvEventManager::Options(i));
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(1));
delete em;
}
@ -40,7 +41,8 @@ TEST(LibuvEventManager, Allocation) {
TEST(LibuvEventManager, ShutdownRef) {
for (int i = 0; i < 10; i++) {
LibuvEventManager* em = new LibuvEventManager(i);
LibuvEventManager* em =
new LibuvEventManager(LibuvEventManager::Options(i));
for (int j = 0; j < i; j++) {
em->ShutdownRef();
}
@ -54,7 +56,8 @@ TEST(LibuvEventManager, ShutdownRef) {
TEST(LibuvEventManager, ShutdownRefAsync) {
for (int i = 0; i < 10; i++) {
LibuvEventManager* em = new LibuvEventManager(i);
LibuvEventManager* em =
new LibuvEventManager(LibuvEventManager::Options(i));
for (int j = 0; j < i; j++) {
em->ShutdownRef();
}

@ -380,7 +380,7 @@ static void test_callback(void) {
bool got_shutdown = false;
class ShutdownCallback : public grpc_experimental_completion_queue_functor {
public:
ShutdownCallback(bool* done) : done_(done) {
explicit ShutdownCallback(bool* done) : done_(done) {
functor_run = &ShutdownCallback::Run;
inlineable = false;
}

@ -104,7 +104,7 @@ grpc_channel* create_secure_channel_for_test(
class FakeHandshakeServer {
public:
FakeHandshakeServer(bool check_num_concurrent_rpcs) {
explicit FakeHandshakeServer(bool check_num_concurrent_rpcs) {
int port = grpc_pick_unused_port_or_die();
address_ = grpc_core::JoinHostPort("localhost", port);
if (check_num_concurrent_rpcs) {

@ -36,7 +36,7 @@ namespace testing {
class TestType {
public:
TestType(bool parse_xds_certificate_providers)
explicit TestType(bool parse_xds_certificate_providers)
: parse_xds_certificate_providers_(parse_xds_certificate_providers) {}
bool parse_xds_certificate_providers() const {

@ -806,7 +806,7 @@ TEST_P(ClientCallbackEnd2endTest, UnaryReactor) {
ResetStub();
class UnaryClient : public grpc::experimental::ClientUnaryReactor {
public:
UnaryClient(grpc::testing::EchoTestService::Stub* stub) {
explicit UnaryClient(grpc::testing::EchoTestService::Stub* stub) {
cli_ctx_.AddMetadata("key1", "val1");
cli_ctx_.AddMetadata("key2", "val2");
request_.mutable_param()->set_echo_metadata_initially(true);
@ -1351,7 +1351,7 @@ TEST_P(ClientCallbackEnd2endTest, SimultaneousReadAndWritesDone) {
class Client : public grpc::experimental::ClientBidiReactor<EchoRequest,
EchoResponse> {
public:
Client(grpc::testing::EchoTestService::Stub* stub) {
explicit Client(grpc::testing::EchoTestService::Stub* stub) {
request_.set_message("Hello bidi ");
stub->experimental_async()->BidiStream(&context_, this);
StartWrite(&request_);
@ -1434,7 +1434,8 @@ TEST_P(ClientCallbackEnd2endTest,
class ReadAllIncomingDataClient
: public grpc::experimental::ClientReadReactor<EchoResponse> {
public:
ReadAllIncomingDataClient(grpc::testing::EchoTestService::Stub* stub) {
explicit ReadAllIncomingDataClient(
grpc::testing::EchoTestService::Stub* stub) {
request_.set_message("Hello client ");
stub->experimental_async()->ResponseStream(&context_, &request_, this);
}

@ -72,7 +72,7 @@ enum class ChannelType {
/* Hijacks Echo RPC and fills in the expected values */
class HijackingInterceptor : public experimental::Interceptor {
public:
HijackingInterceptor(experimental::ClientRpcInfo* info) {
explicit HijackingInterceptor(experimental::ClientRpcInfo* info) {
info_ = info;
// Make sure it is the right method
EXPECT_EQ(strcmp("/grpc.testing.EchoTestService/Echo", info->method()), 0);
@ -178,7 +178,8 @@ class HijackingInterceptorFactory
class HijackingInterceptorMakesAnotherCall : public experimental::Interceptor {
public:
HijackingInterceptorMakesAnotherCall(experimental::ClientRpcInfo* info) {
explicit HijackingInterceptorMakesAnotherCall(
experimental::ClientRpcInfo* info) {
info_ = info;
// Make sure it is the right method
EXPECT_EQ(strcmp("/grpc.testing.EchoTestService/Echo", info->method()), 0);
@ -300,7 +301,8 @@ class HijackingInterceptorMakesAnotherCallFactory
class BidiStreamingRpcHijackingInterceptor : public experimental::Interceptor {
public:
BidiStreamingRpcHijackingInterceptor(experimental::ClientRpcInfo* info) {
explicit BidiStreamingRpcHijackingInterceptor(
experimental::ClientRpcInfo* info) {
info_ = info;
}
@ -370,7 +372,8 @@ class BidiStreamingRpcHijackingInterceptor : public experimental::Interceptor {
class ClientStreamingRpcHijackingInterceptor
: public experimental::Interceptor {
public:
ClientStreamingRpcHijackingInterceptor(experimental::ClientRpcInfo* info) {
explicit ClientStreamingRpcHijackingInterceptor(
experimental::ClientRpcInfo* info) {
info_ = info;
}
void Intercept(experimental::InterceptorBatchMethods* methods) override {
@ -424,7 +427,8 @@ class ClientStreamingRpcHijackingInterceptorFactory
class ServerStreamingRpcHijackingInterceptor
: public experimental::Interceptor {
public:
ServerStreamingRpcHijackingInterceptor(experimental::ClientRpcInfo* info) {
explicit ServerStreamingRpcHijackingInterceptor(
experimental::ClientRpcInfo* info) {
info_ = info;
got_failed_message_ = false;
}
@ -534,7 +538,7 @@ class BidiStreamingRpcHijackingInterceptorFactory
// single RPC should be made on the channel before calling the Verify methods.
class LoggingInterceptor : public experimental::Interceptor {
public:
LoggingInterceptor(experimental::ClientRpcInfo* /*info*/) {
explicit LoggingInterceptor(experimental::ClientRpcInfo* /*info*/) {
pre_send_initial_metadata_ = false;
pre_send_message_count_ = 0;
pre_send_close_ = false;

@ -45,7 +45,8 @@ namespace {
class TestChannel : public experimental::DelegatingChannel {
public:
TestChannel(const std::shared_ptr<ChannelInterface>& delegate_channel)
explicit TestChannel(
const std::shared_ptr<ChannelInterface>& delegate_channel)
: experimental::DelegatingChannel(delegate_channel) {}
// Always returns GRPC_CHANNEL_READY
grpc_connectivity_state GetState(bool /*try_to_connect*/) override {

@ -204,7 +204,8 @@ class TestAuthMetadataProcessor : public AuthMetadataProcessor {
public:
static const char kGoodGuy[];
TestAuthMetadataProcessor(bool is_blocking) : is_blocking_(is_blocking) {}
explicit TestAuthMetadataProcessor(bool is_blocking)
: is_blocking_(is_blocking) {}
std::shared_ptr<CallCredentials> GetCompatibleClientCreds() {
return grpc::MetadataCredentialsFromPlugin(
@ -259,7 +260,7 @@ const char TestAuthMetadataProcessor::kIdentityPropName[] = "novel identity";
class Proxy : public ::grpc::testing::EchoTestService::Service {
public:
Proxy(const std::shared_ptr<Channel>& channel)
explicit Proxy(const std::shared_ptr<Channel>& channel)
: stub_(grpc::testing::EchoTestService::NewStub(channel)) {}
Status Echo(ServerContext* server_context, const EchoRequest* request,
@ -1857,7 +1858,8 @@ TEST_P(SecureEnd2endTest, SetPerCallCredentials) {
class CredentialsInterceptor : public experimental::Interceptor {
public:
CredentialsInterceptor(experimental::ClientRpcInfo* info) : info_(info) {}
explicit CredentialsInterceptor(experimental::ClientRpcInfo* info)
: info_(info) {}
void Intercept(experimental::InterceptorBatchMethods* methods) override {
if (methods->QueryInterceptionHookPoint(

@ -47,7 +47,7 @@ namespace {
class LoggingInterceptor : public experimental::Interceptor {
public:
LoggingInterceptor(experimental::ServerRpcInfo* info) {
explicit LoggingInterceptor(experimental::ServerRpcInfo* info) {
info_ = info;
// Check the method name and compare to the type
@ -150,7 +150,7 @@ class LoggingInterceptorFactory
// Test if SendMessage function family works as expected for sync/callback apis
class SyncSendMessageTester : public experimental::Interceptor {
public:
SyncSendMessageTester(experimental::ServerRpcInfo* /*info*/) {}
explicit SyncSendMessageTester(experimental::ServerRpcInfo* /*info*/) {}
void Intercept(experimental::InterceptorBatchMethods* methods) override {
if (methods->QueryInterceptionHookPoint(
@ -180,7 +180,7 @@ class SyncSendMessageTesterFactory
// Test if SendMessage function family works as expected for sync/callback apis
class SyncSendMessageVerifier : public experimental::Interceptor {
public:
SyncSendMessageVerifier(experimental::ServerRpcInfo* /*info*/) {}
explicit SyncSendMessageVerifier(experimental::ServerRpcInfo* /*info*/) {}
void Intercept(experimental::InterceptorBatchMethods* methods) override {
if (methods->QueryInterceptionHookPoint(

@ -358,7 +358,7 @@ class ClientStats {
// Converts from proto message class.
template <class UpstreamLocalityStats>
LocalityStats(const UpstreamLocalityStats& upstream_locality_stats)
explicit LocalityStats(const UpstreamLocalityStats& upstream_locality_stats)
: total_successful_requests(
upstream_locality_stats.total_successful_requests()),
total_requests_in_progress(

@ -47,7 +47,7 @@ std::shared_ptr<Channel> CreateChannelForTestCase(
class InteropClientContextInspector {
public:
InteropClientContextInspector(const ::grpc::ClientContext& context)
explicit InteropClientContextInspector(const ::grpc::ClientContext& context)
: context_(context) {}
// Inspector methods, able to peek inside ClientContext, follow.
@ -68,7 +68,7 @@ class InteropClientContextInspector {
class AdditionalMetadataInterceptor : public experimental::Interceptor {
public:
AdditionalMetadataInterceptor(
explicit AdditionalMetadataInterceptor(
std::multimap<std::string, std::string> additional_metadata)
: additional_metadata_(std::move(additional_metadata)) {}
@ -91,7 +91,7 @@ class AdditionalMetadataInterceptor : public experimental::Interceptor {
class AdditionalMetadataInterceptorFactory
: public experimental::ClientInterceptorFactoryInterface {
public:
AdditionalMetadataInterceptorFactory(
explicit AdditionalMetadataInterceptorFactory(
std::multimap<std::string, std::string> additional_metadata)
: additional_metadata_(std::move(additional_metadata)) {}

@ -44,7 +44,7 @@ class Http2Client {
private:
class ServiceStub {
public:
ServiceStub(const std::shared_ptr<Channel>& channel);
explicit ServiceStub(const std::shared_ptr<Channel>& channel);
TestService::Stub* Get();

@ -37,7 +37,7 @@ std::shared_ptr<ServerCredentials> CreateInteropServerCredentials();
class InteropServerContextInspector {
public:
InteropServerContextInspector(const ::grpc::ServerContext& context);
explicit InteropServerContextInspector(const ::grpc::ServerContext& context);
// Inspector methods, able to peek inside ServerContext, follow.
std::shared_ptr<const AuthContext> GetAuthContext() const;

@ -77,7 +77,8 @@ const vector<pair<TestCaseType, std::string>> kTestCaseList = {
class WeightedRandomTestSelector {
public:
// Takes a vector of <test_case, weight> pairs as the input
WeightedRandomTestSelector(const vector<pair<TestCaseType, int>>& tests);
explicit WeightedRandomTestSelector(
const vector<pair<TestCaseType, int>>& tests);
// Returns a weighted-randomly chosen test case based on the test cases and
// weights passed in the constructor

@ -50,7 +50,7 @@ using grpc::testing::TestService;
class TestServiceImpl : public TestService::Service {
public:
TestServiceImpl(const std::string& i) : hostname_(i) {}
explicit TestServiceImpl(const std::string& i) : hostname_(i) {}
Status UnaryCall(ServerContext* context, const SimpleRequest* request,
SimpleResponse* response) override {

@ -76,7 +76,7 @@ BENCHMARK(BM_Zalloc)
class BaseChannelFixture {
public:
BaseChannelFixture(grpc_channel* channel) : channel_(channel) {}
explicit BaseChannelFixture(grpc_channel* channel) : channel_(channel) {}
~BaseChannelFixture() { grpc_channel_destroy(channel_); }
grpc_channel* channel() const { return channel_; }

@ -181,7 +181,7 @@ std::unique_ptr<TestClosure> MakeTestClosure(F f) {
template <class F>
grpc_closure* MakeOnceClosure(F f) {
struct C : public grpc_closure {
C(const F& f) : f_(f) {}
explicit C(const F& f) : f_(f) {}
F f_;
static void Execute(void* arg, grpc_error* error) {
static_cast<C*>(arg)->f_(error);
@ -194,7 +194,7 @@ grpc_closure* MakeOnceClosure(F f) {
class Stream {
public:
Stream(Fixture* f) : f_(f) {
explicit Stream(Fixture* f) : f_(f) {
stream_size_ = grpc_transport_stream_size(f->transport());
stream_ = gpr_malloc(stream_size_);
arena_ = grpc_core::Arena::Create(4096);

@ -37,7 +37,7 @@ namespace testing {
// the count reaches 0.
class BlockingCounter {
public:
BlockingCounter(int count) : count_(count) {}
explicit BlockingCounter(int count) : count_(count) {}
void DecrementCount() {
std::lock_guard<std::mutex> l(mu_);
count_--;
@ -130,7 +130,7 @@ BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 2048)
// A functor class that will delete self on end of running.
class SuicideFunctorForAdd : public grpc_experimental_completion_queue_functor {
public:
SuicideFunctorForAdd(BlockingCounter* counter) : counter_(counter) {
explicit SuicideFunctorForAdd(BlockingCounter* counter) : counter_(counter) {
functor_run = &SuicideFunctorForAdd::Run;
inlineable = false;
internal_next = this;

@ -52,7 +52,7 @@ auto MakeVector(size_t length, F f) -> std::vector<decltype(f())> {
class NoOpMutator {
public:
template <class ContextType>
NoOpMutator(ContextType* /*context*/) {}
explicit NoOpMutator(ContextType* /*context*/) {}
};
template <int length>
@ -100,7 +100,7 @@ class RandomAsciiMetadata {
template <class Generator, int kNumKeys>
class Client_AddMetadata : public NoOpMutator {
public:
Client_AddMetadata(ClientContext* context) : NoOpMutator(context) {
explicit Client_AddMetadata(ClientContext* context) : NoOpMutator(context) {
for (int i = 0; i < kNumKeys; i++) {
context->AddMetadata(Generator::Key(), Generator::Value());
}
@ -110,7 +110,8 @@ class Client_AddMetadata : public NoOpMutator {
template <class Generator, int kNumKeys>
class Server_AddInitialMetadata : public NoOpMutator {
public:
Server_AddInitialMetadata(ServerContext* context) : NoOpMutator(context) {
explicit Server_AddInitialMetadata(ServerContext* context)
: NoOpMutator(context) {
for (int i = 0; i < kNumKeys; i++) {
context->AddInitialMetadata(Generator::Key(), Generator::Value());
}

@ -111,8 +111,9 @@ class FullstackFixture : public BaseFixture {
class TCP : public FullstackFixture {
public:
TCP(Service* service, const FixtureConfiguration& fixture_configuration =
FixtureConfiguration())
explicit TCP(Service* service,
const FixtureConfiguration& fixture_configuration =
FixtureConfiguration())
: FullstackFixture(service, fixture_configuration, MakeAddress(&port_)) {}
~TCP() override { grpc_recycle_unused_port(port_); }
@ -130,8 +131,9 @@ class TCP : public FullstackFixture {
class UDS : public FullstackFixture {
public:
UDS(Service* service, const FixtureConfiguration& fixture_configuration =
FixtureConfiguration())
explicit UDS(Service* service,
const FixtureConfiguration& fixture_configuration =
FixtureConfiguration())
: FullstackFixture(service, fixture_configuration, MakeAddress(&port_)) {}
~UDS() override { grpc_recycle_unused_port(port_); }
@ -150,9 +152,9 @@ class UDS : public FullstackFixture {
class InProcess : public FullstackFixture {
public:
InProcess(Service* service,
const FixtureConfiguration& fixture_configuration =
FixtureConfiguration())
explicit InProcess(Service* service,
const FixtureConfiguration& fixture_configuration =
FixtureConfiguration())
: FullstackFixture(service, fixture_configuration, "") {}
~InProcess() override {}
};
@ -241,8 +243,9 @@ class EndpointPairFixture : public BaseFixture {
class SockPair : public EndpointPairFixture {
public:
SockPair(Service* service, const FixtureConfiguration& fixture_configuration =
FixtureConfiguration())
explicit SockPair(Service* service,
const FixtureConfiguration& fixture_configuration =
FixtureConfiguration())
: EndpointPairFixture(service,
grpc_iomgr_create_endpoint_pair("test", nullptr),
fixture_configuration) {}
@ -287,9 +290,9 @@ class InProcessCHTTP2WithExplicitStats : public EndpointPairFixture {
class InProcessCHTTP2 : public InProcessCHTTP2WithExplicitStats {
public:
InProcessCHTTP2(Service* service,
const FixtureConfiguration& fixture_configuration =
FixtureConfiguration())
explicit InProcessCHTTP2(Service* service,
const FixtureConfiguration& fixture_configuration =
FixtureConfiguration())
: InProcessCHTTP2WithExplicitStats(service,
grpc_passthru_endpoint_stats_create(),
fixture_configuration) {}
@ -313,7 +316,8 @@ class MinStackConfiguration : public FixtureConfiguration {
template <class Base>
class MinStackize : public Base {
public:
MinStackize(Service* service) : Base(service, MinStackConfiguration()) {}
explicit MinStackize(Service* service)
: Base(service, MinStackConfiguration()) {}
};
typedef MinStackize<TCP> MinTCP;

@ -45,7 +45,7 @@ namespace testing {
* Maintains context info per RPC
*/
struct CallbackClientRpcContext {
CallbackClientRpcContext(BenchmarkService::Stub* stub)
explicit CallbackClientRpcContext(BenchmarkService::Stub* stub)
: alarm_(nullptr), stub_(stub) {}
~CallbackClientRpcContext() {}
@ -64,7 +64,7 @@ static std::unique_ptr<BenchmarkService::Stub> BenchmarkStubCreator(
class CallbackClient
: public ClientImpl<BenchmarkService::Stub, SimpleRequest> {
public:
CallbackClient(const ClientConfig& config)
explicit CallbackClient(const ClientConfig& config)
: ClientImpl<BenchmarkService::Stub, SimpleRequest>(
config, BenchmarkStubCreator) {
num_threads_ = NumThreads(config);
@ -144,7 +144,8 @@ class CallbackClient
class CallbackUnaryClient final : public CallbackClient {
public:
CallbackUnaryClient(const ClientConfig& config) : CallbackClient(config) {
explicit CallbackUnaryClient(const ClientConfig& config)
: CallbackClient(config) {
for (int ch = 0; ch < config.client_channels(); ch++) {
for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) {
ctx_.emplace_back(
@ -214,7 +215,7 @@ class CallbackUnaryClient final : public CallbackClient {
class CallbackStreamingClient : public CallbackClient {
public:
CallbackStreamingClient(const ClientConfig& config)
explicit CallbackStreamingClient(const ClientConfig& config)
: CallbackClient(config),
messages_per_stream_(config.messages_per_stream()) {
for (int ch = 0; ch < config.client_channels(); ch++) {
@ -244,7 +245,7 @@ class CallbackStreamingClient : public CallbackClient {
class CallbackStreamingPingPongClient : public CallbackStreamingClient {
public:
CallbackStreamingPingPongClient(const ClientConfig& config)
explicit CallbackStreamingPingPongClient(const ClientConfig& config)
: CallbackStreamingClient(config) {}
~CallbackStreamingPingPongClient() override {}
};
@ -342,7 +343,7 @@ class CallbackStreamingPingPongReactor final
class CallbackStreamingPingPongClientImpl final
: public CallbackStreamingPingPongClient {
public:
CallbackStreamingPingPongClientImpl(const ClientConfig& config)
explicit CallbackStreamingPingPongClientImpl(const ClientConfig& config)
: CallbackStreamingPingPongClient(config) {
for (size_t i = 0; i < total_outstanding_rpcs_; i++) {
reactor_.emplace_back(

@ -50,7 +50,7 @@ static std::unique_ptr<BenchmarkService::Stub> BenchmarkStubCreator(
class SynchronousClient
: public ClientImpl<BenchmarkService::Stub, SimpleRequest> {
public:
SynchronousClient(const ClientConfig& config)
explicit SynchronousClient(const ClientConfig& config)
: ClientImpl<BenchmarkService::Stub, SimpleRequest>(
config, BenchmarkStubCreator) {
num_threads_ =
@ -111,7 +111,7 @@ class SynchronousClient
class SynchronousUnaryClient final : public SynchronousClient {
public:
SynchronousUnaryClient(const ClientConfig& config)
explicit SynchronousUnaryClient(const ClientConfig& config)
: SynchronousClient(config) {
StartThreads(num_threads_);
}
@ -143,7 +143,7 @@ class SynchronousUnaryClient final : public SynchronousClient {
template <class StreamType>
class SynchronousStreamingClient : public SynchronousClient {
public:
SynchronousStreamingClient(const ClientConfig& config)
explicit SynchronousStreamingClient(const ClientConfig& config)
: SynchronousClient(config),
context_(num_threads_),
stream_(num_threads_),
@ -219,7 +219,7 @@ class SynchronousStreamingPingPongClient final
: public SynchronousStreamingClient<
grpc::ClientReaderWriter<SimpleRequest, SimpleResponse>> {
public:
SynchronousStreamingPingPongClient(const ClientConfig& config)
explicit SynchronousStreamingPingPongClient(const ClientConfig& config)
: SynchronousStreamingClient(config) {}
~SynchronousStreamingPingPongClient() override {
CleanupAllStreams(
@ -276,7 +276,7 @@ class SynchronousStreamingPingPongClient final
class SynchronousStreamingFromClientClient final
: public SynchronousStreamingClient<grpc::ClientWriter<SimpleRequest>> {
public:
SynchronousStreamingFromClientClient(const ClientConfig& config)
explicit SynchronousStreamingFromClientClient(const ClientConfig& config)
: SynchronousStreamingClient(config), last_issue_(num_threads_) {}
~SynchronousStreamingFromClientClient() override {
CleanupAllStreams(
@ -329,7 +329,7 @@ class SynchronousStreamingFromClientClient final
class SynchronousStreamingFromServerClient final
: public SynchronousStreamingClient<grpc::ClientReader<SimpleResponse>> {
public:
SynchronousStreamingFromServerClient(const ClientConfig& config)
explicit SynchronousStreamingFromServerClient(const ClientConfig& config)
: SynchronousStreamingClient(config), last_recv_(num_threads_) {}
~SynchronousStreamingFromServerClient() override {}
@ -375,7 +375,7 @@ class SynchronousStreamingBothWaysClient final
: public SynchronousStreamingClient<
grpc::ClientReaderWriter<SimpleRequest, SimpleResponse>> {
public:
SynchronousStreamingBothWaysClient(const ClientConfig& config)
explicit SynchronousStreamingBothWaysClient(const ClientConfig& config)
: SynchronousStreamingClient(config) {}
~SynchronousStreamingBothWaysClient() override {
CleanupAllStreams(

@ -157,7 +157,7 @@ class WorkerServiceImpl final : public WorkerService::Service {
// Protect against multiple clients using this worker at once.
class InstanceGuard {
public:
InstanceGuard(WorkerServiceImpl* impl)
explicit InstanceGuard(WorkerServiceImpl* impl)
: impl_(impl), acquired_(impl->TryAcquireInstance()) {}
~InstanceGuard() {
if (acquired_) {

@ -37,7 +37,7 @@ namespace testing {
class Reporter {
public:
/** Construct a reporter with the given \a name. */
Reporter(const string& name) : name_(name) {}
explicit Reporter(const string& name) : name_(name) {}
virtual ~Reporter() {}
@ -94,7 +94,7 @@ class CompositeReporter : public Reporter {
/** Reporter to gpr_log(GPR_INFO). */
class GprLogReporter : public Reporter {
public:
GprLogReporter(const string& name) : Reporter(name) {}
explicit GprLogReporter(const string& name) : Reporter(name) {}
private:
void ReportQPS(const ScenarioResult& result) override;

@ -74,7 +74,8 @@ void mock_socket_mutator_destroy(grpc_socket_mutator* m) {
class MockSocketMutatorServerBuilderOption : public grpc::ServerBuilderOption {
public:
MockSocketMutatorServerBuilderOption(MockSocketMutator* mock_socket_mutator)
explicit MockSocketMutatorServerBuilderOption(
MockSocketMutator* mock_socket_mutator)
: mock_socket_mutator_(mock_socket_mutator) {}
void UpdateArguments(ChannelArguments* args) override {

@ -133,7 +133,7 @@ const int kServerDefaultResponseStreamsToSend = 3;
class TestCliCredentials final : public grpc::testing::CliCredentials {
public:
TestCliCredentials(bool secure = false) : secure_(secure) {}
explicit TestCliCredentials(bool secure = false) : secure_(secure) {}
std::shared_ptr<grpc::ChannelCredentials> GetChannelCredentials()
const override {
if (!secure_) {

@ -29,7 +29,7 @@ namespace grpc {
class SubProcess {
public:
SubProcess(const std::vector<std::string>& args);
explicit SubProcess(const std::vector<std::string>& args);
~SubProcess();
int Join();

Loading…
Cancel
Save