Skip to content

Commit

Permalink
use clang-tidy to modernize-use-override (#16307)
Browse files Browse the repository at this point in the history
* use clang-tidy to modernize-use-override

* Restyle
  • Loading branch information
andy31415 authored Mar 17, 2022
1 parent ba133af commit d80d593
Show file tree
Hide file tree
Showing 45 changed files with 63 additions and 64 deletions.
2 changes: 1 addition & 1 deletion src/app/CASEClientPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ template <size_t N>
class CASEClientPool : public CASEClientPoolDelegate
{
public:
~CASEClientPool() { mClientPool.ReleaseAll(); }
~CASEClientPool() override { mClientPool.ReleaseAll(); }

CASEClient * Allocate(CASEClientInitParams params) override { return mClientPool.CreateObject(params); }

Expand Down
2 changes: 1 addition & 1 deletion src/app/CommandSender.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class CommandSender final : public Messaging::ExchangeDelegate
*
* See Abort() for details on when that might occur.
*/
virtual ~CommandSender() { Abort(); }
~CommandSender() override { Abort(); }

/**
* Gets the inner exchange context object, without ownership.
Expand Down
2 changes: 1 addition & 1 deletion src/app/EventManagement.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class CircularEventBuffer : public TLV::CHIPCircularTLVBuffer
void SetRequiredSpaceforEvicted(size_t aRequiredSpace) { mRequiredSpaceForEvicted = aRequiredSpace; }
size_t GetRequiredSpaceforEvicted() { return mRequiredSpaceForEvicted; }

virtual ~CircularEventBuffer() = default;
~CircularEventBuffer() override = default;

private:
CircularEventBuffer * mpPrev = nullptr; ///< A pointer CircularEventBuffer storing events less important events
Expand Down
2 changes: 1 addition & 1 deletion src/app/OperationalDeviceProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class DLL_EXPORT OperationalDeviceProxy : public DeviceProxy,
public AddressResolve::NodeListener
{
public:
virtual ~OperationalDeviceProxy();
~OperationalDeviceProxy() override;
OperationalDeviceProxy(DeviceProxyInitParams & params, PeerId peerId) : mSecureSession(*this)
{
VerifyOrReturn(params.Validate() == CHIP_NO_ERROR);
Expand Down
2 changes: 1 addition & 1 deletion src/app/OperationalDeviceProxyPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ template <size_t N>
class OperationalDeviceProxyPool : public OperationalDeviceProxyPoolDelegate
{
public:
~OperationalDeviceProxyPool() { mDevicePool.ReleaseAll(); }
~OperationalDeviceProxyPool() override { mDevicePool.ReleaseAll(); }

OperationalDeviceProxy * Allocate(DeviceProxyInitParams & params, PeerId peerId) override
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/ReadClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class ReadClient : public Messaging::ExchangeDelegate
*
* OnDone() will not be called.
*/
virtual ~ReadClient();
~ReadClient() override;

/*
* This forcibly closes the exchange context if a valid one is pointed to. Such a situation does
Expand Down
2 changes: 1 addition & 1 deletion src/app/ReadHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class ReadHandler : public Messaging::ExchangeDelegate
*
* See Abort() for details on when that might occur.
*/
~ReadHandler();
~ReadHandler() override;

/**
* Process a read/subscribe request. Parts of the processing may end up being asynchronous, but the ReadHandler
Expand Down
2 changes: 1 addition & 1 deletion src/app/TimedHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class TimedHandler : public Messaging::ExchangeDelegate
{
public:
TimedHandler() {}
virtual ~TimedHandler() {}
~TimedHandler() override {}

// ExchangeDelegate implementation.
CHIP_ERROR OnMessageReceived(Messaging::ExchangeContext * aExchangeContext, const PayloadHeader & aPayloadHeader,
Expand Down
2 changes: 1 addition & 1 deletion src/app/WriteClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class WriteClient : public Messaging::ExchangeDelegate
*
* See Abort() for details on when that might occur.
*/
virtual ~WriteClient() { Abort(); }
~WriteClient() override { Abort(); }

private:
friend class TestWriteInteraction;
Expand Down
2 changes: 1 addition & 1 deletion src/app/WriteHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class WriteHandler : public Messaging::ExchangeDelegate

bool IsFree() const { return mState == State::Uninitialized; }

virtual ~WriteHandler() = default;
~WriteHandler() override = default;

CHIP_ERROR ProcessAttributeDataIBs(TLV::TLVReader & aAttributeDataIBsReader);
CHIP_ERROR ProcessGroupAttributeDataIBs(TLV::TLVReader & aAttributeDataIBsReader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CommissionerCommands : public chip::Controller::DevicePairingDelegate
{
public:
CommissionerCommands(){};
virtual ~CommissionerCommands(){};
~CommissionerCommands() override{};

virtual CHIP_ERROR ContinueOnChipMainThread(CHIP_ERROR err) = 0;
virtual chip::Controller::DeviceCommissioner & GetCurrentCommissioner() = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class DiscoveryCommands : public chip::Dnssd::CommissioningResolveDelegate, publ
{
public:
DiscoveryCommands(){};
virtual ~DiscoveryCommands(){};
~DiscoveryCommands() override{};

virtual CHIP_ERROR ContinueOnChipMainThread(CHIP_ERROR err) = 0;

Expand Down
2 changes: 1 addition & 1 deletion src/controller/AbstractDnssdDiscoveryController.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class DLL_EXPORT AbstractDnssdDiscoveryController : public Dnssd::CommissioningR
{
public:
AbstractDnssdDiscoveryController() {}
virtual ~AbstractDnssdDiscoveryController() {}
~AbstractDnssdDiscoveryController() override {}

void OnNodeDiscovered(const chip::Dnssd::DiscoveredNodeData & nodeData) override;

Expand Down
6 changes: 3 additions & 3 deletions src/controller/AutoCommissioner.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ class AutoCommissioner : public CommissioningDelegate
{
public:
AutoCommissioner();
virtual ~AutoCommissioner();
~AutoCommissioner() override;
CHIP_ERROR SetCommissioningParameters(const CommissioningParameters & params) override;
void SetOperationalCredentialsDelegate(OperationalCredentialsDelegate * operationalCredentialsDelegate) override;

virtual CHIP_ERROR StartCommissioning(DeviceCommissioner * commissioner, CommissioneeDeviceProxy * proxy) override;
CHIP_ERROR StartCommissioning(DeviceCommissioner * commissioner, CommissioneeDeviceProxy * proxy) override;

virtual CHIP_ERROR CommissioningStepFinished(CHIP_ERROR err, CommissioningDelegate::CommissioningReport report) override;
CHIP_ERROR CommissioningStepFinished(CHIP_ERROR err, CommissioningDelegate::CommissioningReport report) override;

private:
CommissioningStage GetNextCommissioningStage(CommissioningStage currentStage, CHIP_ERROR & lastErr);
Expand Down
2 changes: 1 addition & 1 deletion src/controller/CHIPCommissionableNodeController.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class DLL_EXPORT CommissionableNodeController : public AbstractDnssdDiscoveryCon
{
public:
CommissionableNodeController(chip::Dnssd::Resolver * resolver = nullptr) : mResolver(resolver) {}
virtual ~CommissionableNodeController() {}
~CommissionableNodeController() override {}

CHIP_ERROR DiscoverCommissioners(Dnssd::DiscoveryFilter discoveryFilter = Dnssd::DiscoveryFilter());

Expand Down
4 changes: 2 additions & 2 deletions src/controller/CHIPDeviceController.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class DLL_EXPORT DeviceController : public SessionRecoveryDelegate, public Abstr
{
public:
DeviceController();
virtual ~DeviceController() {}
~DeviceController() override {}

enum class CommissioningWindowOption : uint8_t
{
Expand Down Expand Up @@ -436,7 +436,7 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController,
{
public:
DeviceCommissioner();
~DeviceCommissioner() {}
~DeviceCommissioner() override {}

#if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY // make this commissioner discoverable
/**
Expand Down
2 changes: 1 addition & 1 deletion src/controller/CommissioneeDeviceProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct ControllerDeviceInitParams
class CommissioneeDeviceProxy : public DeviceProxy, public SessionReleaseDelegate
{
public:
~CommissioneeDeviceProxy();
~CommissioneeDeviceProxy() override;
CommissioneeDeviceProxy() : mSecureSession(*this) {}
CommissioneeDeviceProxy(const CommissioneeDeviceProxy &) = delete;

Expand Down
2 changes: 1 addition & 1 deletion src/controller/CommissionerDiscoveryController.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class CommissionerDiscoveryController : public chip::Protocols::UserDirectedComm
*
* This code will call the registered UserPrompter's PromptForCommissionOKPermission
*/
void OnUserDirectedCommissioningRequest(UDCClientState state);
void OnUserDirectedCommissioningRequest(UDCClientState state) override;

/**
* This method should be called after the user has given consent for commissioning of the client
Expand Down
2 changes: 1 addition & 1 deletion src/controller/ExampleOperationalCredentialsIssuer.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class DLL_EXPORT ExampleOperationalCredentialsIssuer : public OperationalCredent
// It is recommended that this index track the fabric index within which this issuer is operating.
//
ExampleOperationalCredentialsIssuer(uint32_t index = 0) { mIndex = index; }
virtual ~ExampleOperationalCredentialsIssuer() {}
~ExampleOperationalCredentialsIssuer() override {}

CHIP_ERROR GenerateNOCChain(const ByteSpan & csrElements, const ByteSpan & attestationSignature, const ByteSpan & DAC,
const ByteSpan & PAI, const ByteSpan & PAA,
Expand Down
2 changes: 1 addition & 1 deletion src/credentials/GroupDataProviderImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class GroupDataProviderImpl : public GroupDataProvider
GroupDataProviderImpl(uint16_t maxGroupsPerFabric, uint16_t maxGroupKeysPerFabric) :
GroupDataProvider(maxGroupsPerFabric, maxGroupKeysPerFabric)
{}
virtual ~GroupDataProviderImpl() {}
~GroupDataProviderImpl() override {}

/**
* @brief Set the storage implementation used for non-volatile storage of configuration data.
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/CHIPCryptoPAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ class P256Keypair : public P256KeypairBase
{
public:
P256Keypair() {}
virtual ~P256Keypair();
~P256Keypair() override;

/**
* @brief Initialize the keypair.
Expand Down
4 changes: 2 additions & 2 deletions src/include/platform/NetworkCommissioning.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class WiFiDriver : public Internal::WirelessDriver
*/
virtual void ScanNetworks(ByteSpan ssid, ScanCallback * callback) = 0;

virtual ~WiFiDriver() = default;
~WiFiDriver() override = default;
};

class ThreadDriver : public Internal::WirelessDriver
Expand Down Expand Up @@ -302,7 +302,7 @@ class ThreadDriver : public Internal::WirelessDriver
*/
virtual void ScanNetworks(ScanCallback * callback) = 0;

virtual ~ThreadDriver() = default;
~ThreadDriver() override = default;
};

class EthernetDriver : public Internal::BaseDriver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class GenericConfigurationManagerImpl : public ConfigurationManager
#endif
void LogDeviceConfig() override;

virtual ~GenericConfigurationManagerImpl() = default;
~GenericConfigurationManagerImpl() override = default;

protected:
#if CHIP_ENABLE_ROTATING_DEVICE_ID && defined(CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID)
Expand Down
4 changes: 2 additions & 2 deletions src/inet/InetLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ class EndPointManagerImplPool : public EndPointManager<typename EndPointImpl::En
using Manager = EndPointManager<typename EndPointImpl::EndPoint>;
using EndPoint = typename EndPointImpl::EndPoint;

EndPointManagerImplPool() = default;
~EndPointManagerImplPool() = default;
EndPointManagerImplPool() = default;
~EndPointManagerImplPool() override = default;

EndPoint * CreateEndPoint() override { return sEndPointPool.CreateObject(*this); }
void ReleaseEndPoint(EndPoint * endPoint) override { sEndPointPool.ReleaseObject(static_cast<EndPointImpl *>(endPoint)); }
Expand Down
2 changes: 1 addition & 1 deletion src/lib/address_resolve/AddressResolve_DefaultImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class NodeLookupHandle : public NodeLookupHandleBase
class Resolver : public ::chip::AddressResolve::Resolver, public Dnssd::OperationalResolveDelegate
{
public:
virtual ~Resolver() = default;
~Resolver() override = default;

// AddressResolve::Resolver

Expand Down
2 changes: 1 addition & 1 deletion src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class AdvertiserMinMdns : public ServiceAdvertiser,
mResponseSender.AddQueryResponder(mQueryResponderAllocatorCommissionable.GetQueryResponder());
mResponseSender.AddQueryResponder(mQueryResponderAllocatorCommissioner.GetQueryResponder());
}
~AdvertiserMinMdns() {}
~AdvertiserMinMdns() override {}

// Service advertiser
CHIP_ERROR Init(chip::Inet::EndPointManager<chip::Inet::UDPEndPoint> * udpEndPointManager) override;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/dnssd/minimal_mdns/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class Server : private chip::PoolImpl<ServerBase::EndpointInfo, kCount, chip::Ob
{
public:
Server() : ServerBase(*static_cast<ServerBase::EndpointInfoPoolType *>(this)) {}
~Server() {}
~Server() override {}
};

} // namespace Minimal
Expand Down
2 changes: 1 addition & 1 deletion src/lib/dnssd/minimal_mdns/responders/QueryResponder.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class QueryResponderBase : public Responder // "_services._dns-sd._udp.local"
public:
/// Builds a new responder with the given storage for the response infos
QueryResponderBase(Internal::QueryResponderInfo * infos, size_t infoSizes);
virtual ~QueryResponderBase() {}
~QueryResponderBase() override {}

/// Setup initial settings (clears all infos and sets up dns-sd query replies)
void Init();
Expand Down
23 changes: 11 additions & 12 deletions src/lib/support/PoolWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,27 +74,26 @@ class PoolProxy<T, N, M, std::tuple<U, ConstructorArguments...>> : public PoolIn
static_assert(std::is_base_of<U, T>::value, "Interface type is not derived from Pool type");

PoolProxy() {}
virtual ~PoolProxy() override {}
~PoolProxy() override {}

virtual U * CreateObject(ConstructorArguments... args) override { return Impl().CreateObject(std::move(args)...); }
U * CreateObject(ConstructorArguments... args) override { return Impl().CreateObject(std::move(args)...); }

virtual void ReleaseObject(U * element) override { Impl().ReleaseObject(static_cast<T *>(element)); }
void ReleaseObject(U * element) override { Impl().ReleaseObject(static_cast<T *>(element)); }

virtual void ReleaseAll() override { Impl().ReleaseAll(); }
void ReleaseAll() override { Impl().ReleaseAll(); }

virtual void ResetObject(U * element, ConstructorArguments... args) override
void ResetObject(U * element, ConstructorArguments... args) override
{
return Impl().ResetObject(static_cast<T *>(element), std::move(args)...);
}

protected:
virtual Loop ForEachActiveObjectInner(void * context,
typename PoolInterface<U, ConstructorArguments...>::Lambda lambda) override
Loop ForEachActiveObjectInner(void * context, typename PoolInterface<U, ConstructorArguments...>::Lambda lambda) override
{
return Impl().ForEachActiveObject([&](T * target) { return lambda(context, static_cast<U *>(target)); });
}
virtual Loop ForEachActiveObjectInner(void * context,
typename PoolInterface<U, ConstructorArguments...>::LambdaConst lambda) const override
Loop ForEachActiveObjectInner(void * context,
typename PoolInterface<U, ConstructorArguments...>::LambdaConst lambda) const override
{
return Impl().ForEachActiveObject([&](const T * target) { return lambda(context, static_cast<const U *>(target)); });
}
Expand All @@ -120,11 +119,11 @@ class PoolImpl : public PoolProxy<T, N, M, Interfaces>...
{
public:
PoolImpl() {}
virtual ~PoolImpl() override {}
~PoolImpl() override {}

protected:
virtual ObjectPool<T, N, M> & Impl() override { return mImpl; }
virtual const ObjectPool<T, N, M> & Impl() const override { return mImpl; }
ObjectPool<T, N, M> & Impl() override { return mImpl; }
const ObjectPool<T, N, M> & Impl() const override { return mImpl; }

private:
ObjectPool<T, N, M> mImpl;
Expand Down
2 changes: 1 addition & 1 deletion src/messaging/ApplicationExchangeDispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ApplicationExchangeDispatch : public ExchangeMessageDispatch
}

ApplicationExchangeDispatch() {}
virtual ~ApplicationExchangeDispatch() {}
~ApplicationExchangeDispatch() override {}

protected:
bool MessagePermitted(uint16_t protocol, uint8_t type) override;
Expand Down
2 changes: 1 addition & 1 deletion src/messaging/ExchangeContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class DLL_EXPORT ExchangeContext : public ReliableMessageContext,
ExchangeContext(ExchangeManager * em, uint16_t ExchangeId, const SessionHandle & session, bool Initiator,
ExchangeDelegate * delegate);

~ExchangeContext();
~ExchangeContext() override;

/**
* Determine whether the context is the initiator of the exchange.
Expand Down
4 changes: 2 additions & 2 deletions src/platform/Linux/NetworkCommissioningDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class LinuxWiFiDriver final : public WiFiDriver
size_t Count() override;
bool Next(Network & item) override;
void Release() override { delete this; }
~WiFiNetworkIterator() = default;
~WiFiNetworkIterator() override = default;

private:
LinuxWiFiDriver * driver;
Expand Down Expand Up @@ -119,7 +119,7 @@ class LinuxThreadDriver final : public ThreadDriver
size_t Count() override;
bool Next(Network & item) override;
void Release() override { delete this; }
~ThreadNetworkIterator() = default;
~ThreadNetworkIterator() override = default;

private:
LinuxThreadDriver * driver;
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/bdx/TransferFacilitator.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class TransferFacilitator : public Messaging::ExchangeDelegate
{
public:
TransferFacilitator() : mExchangeCtx(nullptr), mSystemLayer(nullptr), mPollFreq(kDefaultPollFreq) {}
~TransferFacilitator() = default;
~TransferFacilitator() override = default;

private:
// Inherited from ExchangeContext
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/secure_channel/CASEServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CASEServer : public SessionEstablishmentDelegate, public Messaging::Exchan
{
public:
CASEServer() {}
~CASEServer()
~CASEServer() override
{
if (mExchangeManager != nullptr)
{
Expand Down
Loading

0 comments on commit d80d593

Please sign in to comment.