Skip to content

Commit

Permalink
clang-tidy: modernize-use-override (envoyproxy#7658)
Browse files Browse the repository at this point in the history
Description: Adds `modernize-use-override` as an error and fixes existing issues (automatically applied using `-fix`). https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-override.html
Risk Level: Low
Testing: Existing
Docs Changes: N/A
Release Notes: N/A

Signed-off-by: Derek Argueta <dereka@pinterest.com>
  • Loading branch information
derekargueta authored and lizan committed Jul 20, 2019
1 parent 3b1a79f commit 99a34dc
Show file tree
Hide file tree
Showing 185 changed files with 430 additions and 412 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ WarningsAsErrors: 'abseil-duration-*,
modernize-make-unique,
modernize-return-braced-init-list,
modernize-use-equals-default,
modernize-use-override,
modernize-use-using,
performance-faster-string-find,
performance-for-range-copy,
Expand Down
2 changes: 1 addition & 1 deletion include/envoy/stats/stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct Tag;
*/
class Metric : public RefcountInterface {
public:
virtual ~Metric() = default;
~Metric() override = default;
/**
* Returns the full name of the Metric. This is intended for most uses, such
* as streaming out the name to a stats sink or admin request, or comparing
Expand Down
2 changes: 1 addition & 1 deletion source/common/access_log/access_log_manager_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class AccessLogFileImpl : public AccessLogFile {
Thread::BasicLockable& lock, AccessLogFileStats& stats_,
std::chrono::milliseconds flush_interval_msec,
Thread::ThreadFactory& thread_factory);
~AccessLogFileImpl();
~AccessLogFileImpl() override;

// AccessLog::AccessLogFile
void write(absl::string_view data) override;
Expand Down
2 changes: 1 addition & 1 deletion source/common/common/assert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ActionRegistrationImpl : public ActionRegistration {
debug_assertion_failure_record_action_ = action;
}

~ActionRegistrationImpl() {
~ActionRegistrationImpl() override {
ASSERT(debug_assertion_failure_record_action_ != nullptr);
debug_assertion_failure_record_action_ = nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion source/common/config/grpc_mux_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class GrpcMuxImpl : public GrpcMux,
Event::Dispatcher& dispatcher, const Protobuf::MethodDescriptor& service_method,
Runtime::RandomGenerator& random, Stats::Scope& scope,
const RateLimitSettings& rate_limit_settings);
~GrpcMuxImpl();
~GrpcMuxImpl() override;

void start() override;
GrpcMuxWatchPtr subscribe(const std::string& type_url, const std::set<std::string>& resources,
Expand Down
2 changes: 1 addition & 1 deletion source/common/config/remote_data_fetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class RemoteDataFetcher : public Logger::Loggable<Logger::Id::config>,
RemoteDataFetcher(Upstream::ClusterManager& cm, const ::envoy::api::v2::core::HttpUri& uri,
const std::string& content_hash, RemoteDataFetcherCallback& callback);

virtual ~RemoteDataFetcher() override;
~RemoteDataFetcher() override;

// Http::AsyncClient::Callbacks
void onSuccess(Http::MessagePtr&& response) override;
Expand Down
2 changes: 1 addition & 1 deletion source/common/event/dispatcher_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DispatcherImpl : Logger::Loggable<Logger::Id::main>,
DispatcherImpl(Api::Api& api, Event::TimeSystem& time_system);
DispatcherImpl(Buffer::WatermarkFactoryPtr&& factory, Api::Api& api,
Event::TimeSystem& time_system);
~DispatcherImpl();
~DispatcherImpl() override;

/**
* @return event_base& the libevent base.
Expand Down
2 changes: 1 addition & 1 deletion source/common/filesystem/posix/directory_iterator_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class DirectoryIteratorImpl : public DirectoryIterator {
DirectoryIteratorImpl()
: directory_path_(""), dir_(nullptr), os_sys_calls_(Api::OsSysCallsSingleton::get()) {}

~DirectoryIteratorImpl();
~DirectoryIteratorImpl() override;

DirectoryIteratorImpl& operator++() override;

Expand Down
4 changes: 2 additions & 2 deletions source/common/grpc/google_async_client_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class GoogleAsyncClientThreadLocal : public ThreadLocal::ThreadLocalObject,
Logger::Loggable<Logger::Id::grpc> {
public:
GoogleAsyncClientThreadLocal(Api::Api& api);
~GoogleAsyncClientThreadLocal();
~GoogleAsyncClientThreadLocal() override;

grpc::CompletionQueue& completionQueue() { return cq_; }

Expand Down Expand Up @@ -199,7 +199,7 @@ class GoogleAsyncStreamImpl : public RawAsyncStream,
GoogleAsyncStreamImpl(GoogleAsyncClientImpl& parent, absl::string_view service_full_name,
absl::string_view method_name, RawAsyncStreamCallbacks& callbacks,
const absl::optional<std::chrono::milliseconds>& timeout);
~GoogleAsyncStreamImpl();
~GoogleAsyncStreamImpl() override;

virtual void initialize(bool buffer_body_for_retry);

Expand Down
2 changes: 1 addition & 1 deletion source/common/http/codec_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CodecClient : Logger::Loggable<Logger::Id::client>,
*/
enum class Type { HTTP1, HTTP2 };

~CodecClient();
~CodecClient() override;

/**
* Add a connection callback to the underlying network connection.
Expand Down
2 changes: 1 addition & 1 deletion source/common/http/http1/codec_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ class ServerConnectionImpl : public ServerConnection, public ConnectionImpl {
Http1Settings settings, uint32_t max_request_headers_kb,
bool strict_header_validation);

virtual bool supports_http_10() override { return codec_settings_.accept_http_10_; }
bool supports_http_10() override { return codec_settings_.accept_http_10_; }

private:
/**
Expand Down
2 changes: 1 addition & 1 deletion source/common/http/http2/codec_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ConnectionImpl : public virtual Connection, protected Logger::Loggable<Log
per_stream_buffer_limit_(http2_settings.initial_stream_window_size_), dispatching_(false),
raised_goaway_(false), pending_deferred_reset_(false) {}

~ConnectionImpl();
~ConnectionImpl() override;

// Http::Connection
void dispatch(Buffer::Instance& data) override;
Expand Down
4 changes: 2 additions & 2 deletions source/common/http/http2/conn_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ConnPoolImpl : public ConnectionPool::Instance, public ConnPoolImplBase {
ConnPoolImpl(Event::Dispatcher& dispatcher, Upstream::HostConstSharedPtr host,
Upstream::ResourcePriority priority,
const Network::ConnectionSocket::OptionsSharedPtr& options);
~ConnPoolImpl();
~ConnPoolImpl() override;

// Http::ConnectionPool::Instance
Http::Protocol protocol() const override { return Http::Protocol::Http2; }
Expand All @@ -44,7 +44,7 @@ class ConnPoolImpl : public ConnectionPool::Instance, public ConnPoolImplBase {
public Event::DeferredDeletable,
public Http::ConnectionCallbacks {
ActiveClient(ConnPoolImpl& parent);
~ActiveClient();
~ActiveClient() override;

void onConnectTimeout() { parent_.onConnectTimeout(*this); }

Expand Down
2 changes: 1 addition & 1 deletion source/common/network/listen_socket_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Network {

class SocketImpl : public virtual Socket {
public:
~SocketImpl() { close(); }
~SocketImpl() override { close(); }

// Network::Socket
const Address::InstanceConstSharedPtr& localAddress() const override { return local_address_; }
Expand Down
2 changes: 1 addition & 1 deletion source/common/router/rds_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class StaticRouteConfigProviderImpl : public RouteConfigProvider {
StaticRouteConfigProviderImpl(const envoy::api::v2::RouteConfiguration& config,
Server::Configuration::FactoryContext& factory_context,
RouteConfigProviderManagerImpl& route_config_provider_manager);
~StaticRouteConfigProviderImpl();
~StaticRouteConfigProviderImpl() override;

// Router::RouteConfigProvider
Router::ConfigConstSharedPtr config() override { return config_; }
Expand Down
2 changes: 1 addition & 1 deletion source/common/router/retry_state_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class RetryStateImpl : public RetryState {
const Upstream::ClusterInfo& cluster, Runtime::Loader& runtime,
Runtime::RandomGenerator& random, Event::Dispatcher& dispatcher,
Upstream::ResourcePriority priority);
~RetryStateImpl();
~RetryStateImpl() override;

/**
* Returns the RetryPolicy extracted from the x-envoy-retry-on header.
Expand Down
4 changes: 2 additions & 2 deletions source/common/router/router.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class Filter : Logger::Loggable<Logger::Id::router>,
downstream_end_stream_(false), do_shadowing_(false), is_retry_(false),
attempting_internal_redirect_with_complete_stream_(false) {}

~Filter();
~Filter() override;

// Http::StreamFilterBase
void onDestroy() override;
Expand Down Expand Up @@ -357,7 +357,7 @@ class Filter : Logger::Loggable<Logger::Id::router>,
public Http::ConnectionPool::Callbacks,
public LinkedObject<UpstreamRequest> {
UpstreamRequest(Filter& parent, Http::ConnectionPool::Instance& pool);
~UpstreamRequest();
~UpstreamRequest() override;

void encodeHeaders(bool end_stream);
void encodeData(Buffer::Instance& data, bool end_stream);
Expand Down
4 changes: 2 additions & 2 deletions source/common/stats/histogram_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class HistogramImpl : public HistogramImplHelper {
const std::vector<Tag>& tags)
: HistogramImplHelper(name, tag_extracted_name, tags, parent.symbolTable()), parent_(parent) {
}
~HistogramImpl() {
~HistogramImpl() override {
// We must explicitly free the StatName here in order to supply the
// SymbolTable reference. An RAII alternative would be to store a
// reference to the SymbolTable in MetricImpl, which would cost 8 bytes
Expand All @@ -99,7 +99,7 @@ class NullHistogramImpl : public HistogramImplHelper {
public:
explicit NullHistogramImpl(SymbolTable& symbol_table)
: HistogramImplHelper(symbol_table), symbol_table_(symbol_table) {}
~NullHistogramImpl() { MetricImpl::clear(symbol_table_); }
~NullHistogramImpl() override { MetricImpl::clear(symbol_table_); }

bool used() const override { return false; }
SymbolTable& symbolTable() override { return symbol_table_; }
Expand Down
2 changes: 1 addition & 1 deletion source/common/stats/scope_prefixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ScopePrefixer : public Scope {
OptionalHistogram findHistogram(StatName name) const override;

const SymbolTable& constSymbolTable() const override { return scope_.constSymbolTable(); }
virtual SymbolTable& symbolTable() override { return scope_.symbolTable(); }
SymbolTable& symbolTable() override { return scope_.symbolTable(); }

NullGaugeImpl& nullGauge(const std::string& str) override { return scope_.nullGauge(str); }

Expand Down
10 changes: 5 additions & 5 deletions source/common/tcp/conn_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ConnPoolImpl : Logger::Loggable<Logger::Id::pool>, public ConnectionPool::
const Network::ConnectionSocket::OptionsSharedPtr& options,
Network::TransportSocketOptionsSharedPtr transport_socket_options);

~ConnPoolImpl();
~ConnPoolImpl() override;

// ConnectionPool::Instance
void addDrainedCallback(DrainedCb cb) override;
Expand Down Expand Up @@ -59,7 +59,7 @@ class ConnPoolImpl : Logger::Loggable<Logger::Id::pool>, public ConnectionPool::

struct ConnectionDataImpl : public ConnectionPool::ConnectionData {
ConnectionDataImpl(ConnectionWrapperSharedPtr wrapper) : wrapper_(std::move(wrapper)) {}
~ConnectionDataImpl() { wrapper_->release(false); }
~ConnectionDataImpl() override { wrapper_->release(false); }

// ConnectionPool::ConnectionData
Network::ClientConnection& connection() override { return wrapper_->connection(); }
Expand All @@ -80,7 +80,7 @@ class ConnPoolImpl : Logger::Loggable<Logger::Id::pool>, public ConnectionPool::
ConnReadFilter(ActiveConn& parent) : parent_(parent) {}

// Network::ReadFilter
Network::FilterStatus onData(Buffer::Instance& data, bool end_stream) {
Network::FilterStatus onData(Buffer::Instance& data, bool end_stream) override {
parent_.onUpstreamData(data, end_stream);
return Network::FilterStatus::StopIteration;
}
Expand All @@ -92,7 +92,7 @@ class ConnPoolImpl : Logger::Loggable<Logger::Id::pool>, public ConnectionPool::
public Network::ConnectionCallbacks,
public Event::DeferredDeletable {
ActiveConn(ConnPoolImpl& parent);
~ActiveConn();
~ActiveConn() override;

void onConnectTimeout();
void onUpstreamData(Buffer::Instance& data, bool end_stream);
Expand Down Expand Up @@ -122,7 +122,7 @@ class ConnPoolImpl : Logger::Loggable<Logger::Id::pool>, public ConnectionPool::

struct PendingRequest : LinkedObject<PendingRequest>, public ConnectionPool::Cancellable {
PendingRequest(ConnPoolImpl& parent, ConnectionPool::Callbacks& callbacks);
~PendingRequest();
~PendingRequest() override;

// ConnectionPool::Cancellable
void cancel(ConnectionPool::CancelPolicy cancel_policy) override {
Expand Down
4 changes: 2 additions & 2 deletions source/common/tcp_proxy/tcp_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class Filter : public Network::ReadFilter,
public:
Filter(ConfigSharedPtr config, Upstream::ClusterManager& cluster_manager,
TimeSource& time_source);
~Filter();
~Filter() override;

// Network::ReadFilter
Network::FilterStatus onData(Buffer::Instance& data, bool end_stream) override;
Expand Down Expand Up @@ -315,7 +315,7 @@ using DrainerPtr = std::unique_ptr<Drainer>;

class UpstreamDrainManager : public ThreadLocal::ThreadLocalObject {
public:
~UpstreamDrainManager();
~UpstreamDrainManager() override;
void add(const Config::SharedConfigSharedPtr& config,
Tcp::ConnectionPool::ConnectionDataPtr&& upstream_conn_data,
const std::shared_ptr<Filter::UpstreamCallbacks>& callbacks,
Expand Down
4 changes: 2 additions & 2 deletions source/common/thread_local/thread_local_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace ThreadLocal {
class InstanceImpl : Logger::Loggable<Logger::Id::main>, public Instance {
public:
InstanceImpl() : main_thread_id_(std::this_thread::get_id()) {}
~InstanceImpl();
~InstanceImpl() override;

// ThreadLocal::Instance
SlotPtr allocateSlot() override;
Expand All @@ -30,7 +30,7 @@ class InstanceImpl : Logger::Loggable<Logger::Id::main>, public Instance {
private:
struct SlotImpl : public Slot {
SlotImpl(InstanceImpl& parent, uint64_t index) : parent_(parent), index_(index) {}
~SlotImpl() { parent_.removeSlot(*this); }
~SlotImpl() override { parent_.removeSlot(*this); }

// ThreadLocal::Slot
ThreadLocalObjectSharedPtr get() override;
Expand Down
2 changes: 1 addition & 1 deletion source/common/upstream/cluster_factory_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ template <class ConfigProto> class ConfigurableClusterFactoryBase : public Clust
ConfigurableClusterFactoryBase(const std::string& name) : ClusterFactoryImplBase(name) {}

private:
virtual std::pair<ClusterImplBaseSharedPtr, ThreadAwareLoadBalancerPtr>
std::pair<ClusterImplBaseSharedPtr, ThreadAwareLoadBalancerPtr>
createClusterImpl(const envoy::api::v2::Cluster& cluster, ClusterFactoryContext& context,
Server::Configuration::TransportSocketFactoryContext& socket_factory_context,
Stats::ScopePtr&& stats_scope) override {
Expand Down
4 changes: 2 additions & 2 deletions source/common/upstream/cluster_manager_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class ClusterManagerImpl : public ClusterManager, Logger::Loggable<Logger::Id::u
struct ClusterEntry : public ThreadLocalCluster {
ClusterEntry(ThreadLocalClusterManagerImpl& parent, ClusterInfoConstSharedPtr cluster,
const LoadBalancerFactorySharedPtr& lb_factory);
~ClusterEntry();
~ClusterEntry() override;

Http::ConnectionPool::Instance* connPool(ResourcePriority priority, Http::Protocol protocol,
LoadBalancerContext* context);
Expand Down Expand Up @@ -323,7 +323,7 @@ class ClusterManagerImpl : public ClusterManager, Logger::Loggable<Logger::Id::u

ThreadLocalClusterManagerImpl(ClusterManagerImpl& parent, Event::Dispatcher& dispatcher,
const absl::optional<std::string>& local_cluster_name);
~ThreadLocalClusterManagerImpl();
~ThreadLocalClusterManagerImpl() override;
void drainConnPools(const HostVector& hosts);
void drainConnPools(HostSharedPtr old_host, ConnPoolsContainer& container);
void clearContainer(HostSharedPtr old_host, ConnPoolsContainer& container);
Expand Down
2 changes: 1 addition & 1 deletion source/common/upstream/health_checker_base_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class HealthCheckerImplBase : public HealthChecker,
protected:
class ActiveHealthCheckSession : public Event::DeferredDeletable {
public:
virtual ~ActiveHealthCheckSession();
~ActiveHealthCheckSession() override;
HealthTransition setUnhealthy(envoy::data::core::v2alpha::HealthCheckFailureType type);
void onDeferredDeleteBase();
void start() { onInitialInterval(); }
Expand Down
2 changes: 1 addition & 1 deletion source/common/upstream/load_balancer_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class ZoneAwareLoadBalancerBase : public LoadBalancerBase {
ClusterStats& stats, Runtime::Loader& runtime,
Runtime::RandomGenerator& random,
const envoy::api::v2::Cluster::CommonLbConfig& common_config);
~ZoneAwareLoadBalancerBase();
~ZoneAwareLoadBalancerBase() override;

// When deciding which hosts to use on an LB decision, we need to know how to index into the
// priority_set. This priority_set cursor is used by ZoneAwareLoadBalancerBase subclasses, e.g.
Expand Down
2 changes: 1 addition & 1 deletion source/common/upstream/outlier_detection_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class DetectorImpl : public Detector, public std::enable_shared_from_this<Detect
create(const Cluster& cluster, const envoy::api::v2::cluster::OutlierDetection& config,
Event::Dispatcher& dispatcher, Runtime::Loader& runtime, TimeSource& time_source,
EventLoggerSharedPtr event_logger);
~DetectorImpl();
~DetectorImpl() override;

void onConsecutive5xx(HostSharedPtr host);
void onConsecutiveGatewayFailure(HostSharedPtr host);
Expand Down
2 changes: 1 addition & 1 deletion source/common/upstream/resource_manager_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ResourceManagerImpl : public ResourceManager {
remaining_(remaining) {
remaining_.set(max);
}
~ResourceImpl() { ASSERT(current_ == 0); }
~ResourceImpl() override { ASSERT(current_ == 0); }

// Upstream::Resource
bool canCreate() override { return current_ < max(); }
Expand Down
13 changes: 6 additions & 7 deletions source/common/upstream/upstream_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class HostDescriptionImpl : virtual public HostDescription {
absl::ReaderMutexLock lock(&metadata_mutex_);
return metadata_;
}
virtual void metadata(const envoy::api::v2::core::Metadata& new_metadata) override {
void metadata(const envoy::api::v2::core::Metadata& new_metadata) override {
absl::WriterMutexLock lock(&metadata_mutex_);
metadata_ = std::make_shared<envoy::api::v2::core::Metadata>(new_metadata);
}
Expand Down Expand Up @@ -483,13 +483,12 @@ class PrioritySetImpl : public PrioritySet {
ASSERT(!parent_.batch_update_);
parent_.batch_update_ = true;
}
~BatchUpdateScope() { parent_.batch_update_ = false; }
~BatchUpdateScope() override { parent_.batch_update_ = false; }

virtual void updateHosts(uint32_t priority,
PrioritySet::UpdateHostsParams&& update_hosts_params,
LocalityWeightsConstSharedPtr locality_weights,
const HostVector& hosts_added, const HostVector& hosts_removed,
absl::optional<uint32_t> overprovisioning_factor) override;
void updateHosts(uint32_t priority, PrioritySet::UpdateHostsParams&& update_hosts_params,
LocalityWeightsConstSharedPtr locality_weights, const HostVector& hosts_added,
const HostVector& hosts_removed,
absl::optional<uint32_t> overprovisioning_factor) override;

std::unordered_set<HostSharedPtr> all_hosts_added_;
std::unordered_set<HostSharedPtr> all_hosts_removed_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DnsCacheImpl : public DnsCache, Logger::Loggable<Logger::Id::forward_proxy
DnsCacheImpl(Event::Dispatcher& main_thread_dispatcher, ThreadLocal::SlotAllocator& tls,
Stats::Scope& root_scope,
const envoy::config::common::dynamic_forward_proxy::v2alpha::DnsCacheConfig& config);
~DnsCacheImpl();
~DnsCacheImpl() override;

// DnsCache
LoadDnsCacheEntryResult loadDnsCacheEntry(absl::string_view host, uint16_t default_port,
Expand All @@ -63,7 +63,7 @@ class DnsCacheImpl : public DnsCache, Logger::Loggable<Logger::Id::forward_proxy

// Per-thread DNS cache info including the currently known hosts as well as any pending callbacks.
struct ThreadLocalHostInfo : public ThreadLocal::ThreadLocalObject {
~ThreadLocalHostInfo();
~ThreadLocalHostInfo() override;
void updateHostMap(const TlsHostMapSharedPtr& new_host_map);

TlsHostMapSharedPtr host_map_;
Expand Down
Loading

0 comments on commit 99a34dc

Please sign in to comment.