From e24b32a148e5cf067110d4c18bafecd48f5cd382 Mon Sep 17 00:00:00 2001 From: Lizan Zhou Date: Sat, 8 Aug 2020 14:51:38 -0700 Subject: [PATCH] build: mark virtual functions called in ctor/dtor final Signed-off-by: Lizan Zhou --- source/common/network/connection_impl.h | 4 ++-- .../ssl/certificate_validation_context_config_impl.h | 2 +- source/common/stats/allocator_impl.cc | 2 +- source/common/stats/histogram_impl.h | 2 +- source/common/stats/scope_prefixer.h | 4 ++-- source/common/stats/thread_local_store.h | 7 ++++--- source/common/tcp_proxy/tcp_proxy.h | 2 +- source/common/upstream/upstream_impl.h | 2 +- .../common/dynamic_forward_proxy/dns_cache_impl.h | 2 +- source/extensions/filters/http/common/jwks_fetcher.cc | 2 +- source/extensions/filters/http/jwt_authn/jwks_cache.cc | 2 +- source/extensions/filters/udp/udp_proxy/udp_proxy_filter.h | 2 +- 12 files changed, 17 insertions(+), 16 deletions(-) diff --git a/source/common/network/connection_impl.h b/source/common/network/connection_impl.h index b464e2af96d1..17ebe609a263 100644 --- a/source/common/network/connection_impl.h +++ b/source/common/network/connection_impl.h @@ -60,7 +60,7 @@ class ConnectionImpl : public ConnectionImplBase, public TransportSocketCallback // Network::Connection void addBytesSentCallback(BytesSentCb cb) override; void enableHalfClose(bool enabled) override; - void close(ConnectionCloseType type) override; + void close(ConnectionCloseType type) final; std::string nextProtocol() const override { return transport_socket_->protocol(); } void noDelay(bool enable) override; void readDisable(bool disable) override; @@ -132,7 +132,7 @@ class ConnectionImpl : public ConnectionImplBase, public TransportSocketCallback bool consumerWantsToRead(); // Network::ConnectionImplBase - void closeConnectionImmediately() override; + void closeConnectionImmediately() final; void closeSocket(ConnectionEvent close_type); diff --git a/source/common/ssl/certificate_validation_context_config_impl.h b/source/common/ssl/certificate_validation_context_config_impl.h index f054039ee1ba..1636c2ed0713 100644 --- a/source/common/ssl/certificate_validation_context_config_impl.h +++ b/source/common/ssl/certificate_validation_context_config_impl.h @@ -21,7 +21,7 @@ class CertificateValidationContextConfigImpl : public CertificateValidationConte const std::string& certificateRevocationList() const override { return certificate_revocation_list_; } - const std::string& certificateRevocationListPath() const override { + const std::string& certificateRevocationListPath() const final { return certificate_revocation_list_path_; } const std::vector& verifySubjectAltNameList() const override { diff --git a/source/common/stats/allocator_impl.cc b/source/common/stats/allocator_impl.cc index 5e507db18522..63e3159a842e 100644 --- a/source/common/stats/allocator_impl.cc +++ b/source/common/stats/allocator_impl.cc @@ -63,7 +63,7 @@ template class StatsSharedImpl : public MetricImpl } // Metric - SymbolTable& symbolTable() override { return alloc_.symbolTable(); } + SymbolTable& symbolTable() final { return alloc_.symbolTable(); } bool used() const override { return flags_ & Metric::Flags::Used; } // RefcountInterface diff --git a/source/common/stats/histogram_impl.h b/source/common/stats/histogram_impl.h index a58c60fd5fc5..67c2d7d17066 100644 --- a/source/common/stats/histogram_impl.h +++ b/source/common/stats/histogram_impl.h @@ -108,7 +108,7 @@ class HistogramImpl : public HistogramImplHelper { void recordValue(uint64_t value) override { parent_.deliverHistogramToSinks(*this, value); } bool used() const override { return true; } - SymbolTable& symbolTable() override { return parent_.symbolTable(); } + SymbolTable& symbolTable() final { return parent_.symbolTable(); } private: Unit unit_; diff --git a/source/common/stats/scope_prefixer.h b/source/common/stats/scope_prefixer.h index 4257c1dd5ddf..b6872bc98dff 100644 --- a/source/common/stats/scope_prefixer.h +++ b/source/common/stats/scope_prefixer.h @@ -49,8 +49,8 @@ class ScopePrefixer : public Scope { HistogramOptConstRef findHistogram(StatName name) const override; TextReadoutOptConstRef findTextReadout(StatName name) const override; - const SymbolTable& constSymbolTable() const override { return scope_.constSymbolTable(); } - SymbolTable& symbolTable() override { return scope_.symbolTable(); } + const SymbolTable& constSymbolTable() const final { return scope_.constSymbolTable(); } + SymbolTable& symbolTable() final { return scope_.symbolTable(); } NullGaugeImpl& nullGauge(const std::string& str) override { return scope_.nullGauge(str); } diff --git a/source/common/stats/thread_local_store.h b/source/common/stats/thread_local_store.h index 23ce40e5fc15..c86844a2d38c 100644 --- a/source/common/stats/thread_local_store.h +++ b/source/common/stats/thread_local_store.h @@ -59,7 +59,7 @@ class ThreadLocalHistogramImpl : public HistogramImplHelper { void recordValue(uint64_t value) override; // Stats::Metric - SymbolTable& symbolTable() override { return symbol_table_; } + SymbolTable& symbolTable() final { return symbol_table_; } bool used() const override { return used_; } private: @@ -334,13 +334,14 @@ class ThreadLocalStoreImpl : Logger::Loggable, public StoreRo ScopePtr createScope(const std::string& name) override { return parent_.createScope(symbolTable().toString(prefix_.statName()) + "." + name); } - const SymbolTable& constSymbolTable() const override { return parent_.constSymbolTable(); } - SymbolTable& symbolTable() override { return parent_.symbolTable(); } + const SymbolTable& constSymbolTable() const final { return parent_.constSymbolTable(); } + SymbolTable& symbolTable() final { return parent_.symbolTable(); } Counter& counterFromString(const std::string& name) override { StatNameManagedStorage storage(name, symbolTable()); return counterFromStatName(storage.statName()); } + Gauge& gaugeFromString(const std::string& name, Gauge::ImportMode import_mode) override { StatNameManagedStorage storage(name, symbolTable()); return gaugeFromStatName(storage.statName(), import_mode); diff --git a/source/common/tcp_proxy/tcp_proxy.h b/source/common/tcp_proxy/tcp_proxy.h index 871be2ad16f8..8a402e8a4cd2 100644 --- a/source/common/tcp_proxy/tcp_proxy.h +++ b/source/common/tcp_proxy/tcp_proxy.h @@ -322,7 +322,7 @@ class Filter : public Network::ReadFilter, bool on_high_watermark_called_{false}; }; - virtual StreamInfo::StreamInfo& getStreamInfo(); + StreamInfo::StreamInfo& getStreamInfo(); protected: struct DownstreamCallbacks : public Network::ConnectionCallbacks { diff --git a/source/common/upstream/upstream_impl.h b/source/common/upstream/upstream_impl.h index 999962a5b3b4..4a9e0a06468d 100644 --- a/source/common/upstream/upstream_impl.h +++ b/source/common/upstream/upstream_impl.h @@ -196,7 +196,7 @@ class HostImpl : public HostDescriptionImpl, } void healthFlagClear(HealthFlag flag) override { health_flags_ &= ~enumToInt(flag); } bool healthFlagGet(HealthFlag flag) const override { return health_flags_ & enumToInt(flag); } - void healthFlagSet(HealthFlag flag) override { health_flags_ |= enumToInt(flag); } + void healthFlagSet(HealthFlag flag) final { health_flags_ |= enumToInt(flag); } ActiveHealthFailureType getActiveHealthFailureType() const override { return active_health_failure_type_; diff --git a/source/extensions/common/dynamic_forward_proxy/dns_cache_impl.h b/source/extensions/common/dynamic_forward_proxy/dns_cache_impl.h index 6ba35d5a5f31..a7f1426c8be3 100644 --- a/source/extensions/common/dynamic_forward_proxy/dns_cache_impl.h +++ b/source/extensions/common/dynamic_forward_proxy/dns_cache_impl.h @@ -89,7 +89,7 @@ class DnsCacheImpl : public DnsCache, Logger::Loggablecancel(); ENVOY_LOG(debug, "fetch pubkey [uri = {}]: canceled", uri_->uri()); diff --git a/source/extensions/filters/http/jwt_authn/jwks_cache.cc b/source/extensions/filters/http/jwt_authn/jwks_cache.cc index a6020ad9c055..7ec91acd9806 100644 --- a/source/extensions/filters/http/jwt_authn/jwks_cache.cc +++ b/source/extensions/filters/http/jwt_authn/jwks_cache.cc @@ -115,7 +115,7 @@ class JwksCacheImpl : public JwksCache { return it->second; } - JwksData* findByProvider(const std::string& provider) override { + JwksData* findByProvider(const std::string& provider) final { const auto it = jwks_data_map_.find(provider); if (it == jwks_data_map_.end()) { return nullptr; diff --git a/source/extensions/filters/udp/udp_proxy/udp_proxy_filter.h b/source/extensions/filters/udp/udp_proxy/udp_proxy_filter.h index 68a85b3699d8..90c1f345ac38 100644 --- a/source/extensions/filters/udp/udp_proxy/udp_proxy_filter.h +++ b/source/extensions/filters/udp/udp_proxy/udp_proxy_filter.h @@ -226,7 +226,7 @@ class UdpProxyFilter : public Network::UdpListenerReadFilter, } // Upstream::ClusterUpdateCallbacks - void onClusterAddOrUpdate(Upstream::ThreadLocalCluster& cluster) override; + void onClusterAddOrUpdate(Upstream::ThreadLocalCluster& cluster) final; void onClusterRemoval(const std::string& cluster_name) override; const UdpProxyFilterConfigSharedPtr config_;