From d53cb2ae677b0fe7a17d3007ce5470380141e945 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Tue, 12 Apr 2022 17:44:41 +0000 Subject: [PATCH] Fixup explicit on some constructors. This CL adds explicit to various single argument constructors. The explicit is removed from zero argument constructors. None of these changes required call sites to change. Bug: dawn:1339 Change-Id: I7dfcf1b393e7dd379e29cd9bc613cb0626a9a967 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86365 Auto-Submit: Dan Sinclair Kokoro: Kokoro Reviewed-by: Ben Clayton Commit-Queue: Dan Sinclair --- src/dawn/common/BitSetIterator.h | 4 ++-- src/dawn/common/LinkedList.h | 2 +- src/dawn/common/RefCounted.h | 2 +- src/dawn/common/ityp_bitset.h | 2 +- src/dawn/common/ityp_stack_vec.h | 2 +- src/dawn/native/BindGroup.h | 2 +- src/dawn/native/BindGroupLayout.h | 2 +- src/dawn/native/BuddyAllocator.h | 2 +- src/dawn/native/CommandBuffer.h | 2 +- src/dawn/native/ComputePipeline.cpp | 2 +- src/dawn/native/ComputePipeline.h | 2 +- src/dawn/native/DawnNative.cpp | 3 ++- src/dawn/native/DynamicUploader.h | 2 +- src/dawn/native/EnumMaskIterator.h | 5 +++-- src/dawn/native/ExternalTexture.h | 2 +- src/dawn/native/PerStage.h | 2 +- src/dawn/native/PersistentCache.h | 2 +- src/dawn/native/Pipeline.h | 2 +- src/dawn/native/PipelineLayout.h | 2 +- src/dawn/native/PooledResourceMemoryAllocator.h | 2 +- src/dawn/native/QuerySet.cpp | 2 +- src/dawn/native/QuerySet.h | 2 +- src/dawn/native/Queue.cpp | 2 +- src/dawn/native/RenderPipeline.cpp | 2 +- src/dawn/native/RenderPipeline.h | 2 +- src/dawn/native/Sampler.h | 2 +- src/dawn/native/ShaderModule.cpp | 2 +- src/dawn/native/ShaderModule.h | 2 +- src/dawn/native/StagingBuffer.h | 2 +- src/dawn/native/SwapChain.cpp | 3 ++- src/dawn/native/SwapChain.h | 2 +- src/dawn/native/Texture.h | 2 +- src/dawn/native/TintUtils.h | 2 +- src/dawn/native/metal/BackendMTL.h | 2 +- src/dawn/native/null/DeviceNull.cpp | 3 ++- src/dawn/native/null/DeviceNull.h | 2 +- src/dawn/native/utils/WGPUHelpers.h | 2 +- src/dawn/native/vulkan/BackendVk.h | 2 +- src/dawn/native/vulkan/FencedDeleter.h | 2 +- src/dawn/native/vulkan/RenderPassCache.h | 2 +- src/dawn/native/vulkan/ResourceMemoryAllocatorVk.h | 2 +- src/dawn/native/vulkan/VulkanFunctions.h | 2 +- src/dawn/platform/WorkerThread.cpp | 3 +-- src/dawn/utils/TerribleCommandBuffer.h | 2 +- src/dawn/wire/ChunkedCommandSerializer.h | 2 +- src/dawn/wire/server/ServerMemoryTransferService_mock.h | 4 ++-- 46 files changed, 53 insertions(+), 50 deletions(-) diff --git a/src/dawn/common/BitSetIterator.h b/src/dawn/common/BitSetIterator.h index a6d3a2354e..05f2916af8 100644 --- a/src/dawn/common/BitSetIterator.h +++ b/src/dawn/common/BitSetIterator.h @@ -34,13 +34,13 @@ T roundUp(const T value, const T alignment) { template class BitSetIterator final { public: - BitSetIterator(const std::bitset& bitset); + explicit BitSetIterator(const std::bitset& bitset); BitSetIterator(const BitSetIterator& other); BitSetIterator& operator=(const BitSetIterator& other); class Iterator final { public: - Iterator(const std::bitset& bits); + explicit Iterator(const std::bitset& bits); Iterator& operator++(); bool operator==(const Iterator& other) const; diff --git a/src/dawn/common/LinkedList.h b/src/dawn/common/LinkedList.h index 81d6889239..5227041ca2 100644 --- a/src/dawn/common/LinkedList.h +++ b/src/dawn/common/LinkedList.h @@ -235,7 +235,7 @@ class LinkedList { template class LinkedListIterator { public: - LinkedListIterator(LinkNode* node) : current_(node), next_(node->next()) { + explicit LinkedListIterator(LinkNode* node) : current_(node), next_(node->next()) { } // We keep an early reference to the next node in the list so that even if the current element diff --git a/src/dawn/common/RefCounted.h b/src/dawn/common/RefCounted.h index d9f92aa184..ef70d4df40 100644 --- a/src/dawn/common/RefCounted.h +++ b/src/dawn/common/RefCounted.h @@ -22,7 +22,7 @@ class RefCounted { public: - RefCounted(uint64_t payload = 0); + explicit RefCounted(uint64_t payload = 0); uint64_t GetRefCountForTesting() const; uint64_t GetRefCountPayload() const; diff --git a/src/dawn/common/ityp_bitset.h b/src/dawn/common/ityp_bitset.h index 0d181c3dd6..7c5909dda6 100644 --- a/src/dawn/common/ityp_bitset.h +++ b/src/dawn/common/ityp_bitset.h @@ -30,7 +30,7 @@ namespace ityp { static_assert(sizeof(I) <= sizeof(size_t)); - constexpr bitset(const Base& rhs) : Base(rhs) { + explicit constexpr bitset(const Base& rhs) : Base(rhs) { } public: diff --git a/src/dawn/common/ityp_stack_vec.h b/src/dawn/common/ityp_stack_vec.h index ada5637a18..f1f260111c 100644 --- a/src/dawn/common/ityp_stack_vec.h +++ b/src/dawn/common/ityp_stack_vec.h @@ -31,7 +31,7 @@ namespace ityp { public: stack_vec() : Base() { } - stack_vec(Index size) : Base() { + explicit stack_vec(Index size) : Base() { this->container().resize(static_cast(size)); } diff --git a/src/dawn/native/BindGroup.h b/src/dawn/native/BindGroup.h index 61e373ae5b..6ec3c7a633 100644 --- a/src/dawn/native/BindGroup.h +++ b/src/dawn/native/BindGroup.h @@ -74,7 +74,7 @@ namespace dawn::native { } // Constructor used only for mocking and testing. - BindGroupBase(DeviceBase* device); + explicit BindGroupBase(DeviceBase* device); void DestroyImpl() override; ~BindGroupBase() override; diff --git a/src/dawn/native/BindGroupLayout.h b/src/dawn/native/BindGroupLayout.h index 3e11a283ff..c8cb27c111 100644 --- a/src/dawn/native/BindGroupLayout.h +++ b/src/dawn/native/BindGroupLayout.h @@ -135,7 +135,7 @@ namespace dawn::native { protected: // Constructor used only for mocking and testing. - BindGroupLayoutBase(DeviceBase* device); + explicit BindGroupLayoutBase(DeviceBase* device); void DestroyImpl() override; template diff --git a/src/dawn/native/BuddyAllocator.h b/src/dawn/native/BuddyAllocator.h index 30717502e9..d22bd58812 100644 --- a/src/dawn/native/BuddyAllocator.h +++ b/src/dawn/native/BuddyAllocator.h @@ -35,7 +35,7 @@ namespace dawn::native { // class BuddyAllocator { public: - BuddyAllocator(uint64_t maxSize); + explicit BuddyAllocator(uint64_t maxSize); ~BuddyAllocator(); // Required methods. diff --git a/src/dawn/native/CommandBuffer.h b/src/dawn/native/CommandBuffer.h index a41b48293a..455a8d9c02 100644 --- a/src/dawn/native/CommandBuffer.h +++ b/src/dawn/native/CommandBuffer.h @@ -46,7 +46,7 @@ namespace dawn::native { protected: // Constructor used only for mocking and testing. - CommandBufferBase(DeviceBase* device); + explicit CommandBufferBase(DeviceBase* device); void DestroyImpl() override; CommandIterator mCommands; diff --git a/src/dawn/native/ComputePipeline.cpp b/src/dawn/native/ComputePipeline.cpp index 2de7f32009..ecd3d799ca 100644 --- a/src/dawn/native/ComputePipeline.cpp +++ b/src/dawn/native/ComputePipeline.cpp @@ -71,7 +71,7 @@ namespace dawn::native { ComputePipelineBase* ComputePipelineBase::MakeError(DeviceBase* device) { class ErrorComputePipeline final : public ComputePipelineBase { public: - ErrorComputePipeline(DeviceBase* device) + explicit ErrorComputePipeline(DeviceBase* device) : ComputePipelineBase(device, ObjectBase::kError) { } diff --git a/src/dawn/native/ComputePipeline.h b/src/dawn/native/ComputePipeline.h index 6de7ac55b9..257bd85af0 100644 --- a/src/dawn/native/ComputePipeline.h +++ b/src/dawn/native/ComputePipeline.h @@ -43,7 +43,7 @@ namespace dawn::native { protected: // Constructor used only for mocking and testing. - ComputePipelineBase(DeviceBase* device); + explicit ComputePipelineBase(DeviceBase* device); void DestroyImpl() override; private: diff --git a/src/dawn/native/DawnNative.cpp b/src/dawn/native/DawnNative.cpp index 1785c6d651..136685c0f1 100644 --- a/src/dawn/native/DawnNative.cpp +++ b/src/dawn/native/DawnNative.cpp @@ -28,7 +28,8 @@ namespace dawn::native { namespace { struct ComboDeprecatedDawnDeviceDescriptor : DeviceDescriptor { - ComboDeprecatedDawnDeviceDescriptor(const DawnDeviceDescriptor* deviceDescriptor) { + explicit ComboDeprecatedDawnDeviceDescriptor( + const DawnDeviceDescriptor* deviceDescriptor) { dawn::WarningLog() << "DawnDeviceDescriptor is deprecated. Please use " "WGPUDeviceDescriptor instead."; diff --git a/src/dawn/native/DynamicUploader.h b/src/dawn/native/DynamicUploader.h index 3bec13cd3b..c7b24a8c41 100644 --- a/src/dawn/native/DynamicUploader.h +++ b/src/dawn/native/DynamicUploader.h @@ -32,7 +32,7 @@ namespace dawn::native { class DynamicUploader { public: - DynamicUploader(DeviceBase* device); + explicit DynamicUploader(DeviceBase* device); ~DynamicUploader() = default; // We add functions to Release StagingBuffers to the DynamicUploader as there's diff --git a/src/dawn/native/EnumMaskIterator.h b/src/dawn/native/EnumMaskIterator.h index 70e226879e..ec2328561c 100644 --- a/src/dawn/native/EnumMaskIterator.h +++ b/src/dawn/native/EnumMaskIterator.h @@ -28,14 +28,15 @@ namespace dawn::native { using U = std::underlying_type_t; public: - EnumMaskIterator(const T& mask) : mBitSetIterator(std::bitset(static_cast(mask))) { + explicit EnumMaskIterator(const T& mask) + : mBitSetIterator(std::bitset(static_cast(mask))) { // If you hit this ASSERT it means that you forgot to update EnumBitmaskSize::value; ASSERT(U(mask) == 0 || Log2(uint64_t(U(mask))) < N); } class Iterator final { public: - Iterator(const typename BitSetIterator::Iterator& iter) : mIter(iter) { + explicit Iterator(const typename BitSetIterator::Iterator& iter) : mIter(iter) { } Iterator& operator++() { diff --git a/src/dawn/native/ExternalTexture.h b/src/dawn/native/ExternalTexture.h index 23f65d4eef..771659b5c6 100644 --- a/src/dawn/native/ExternalTexture.h +++ b/src/dawn/native/ExternalTexture.h @@ -54,7 +54,7 @@ namespace dawn::native { protected: // Constructor used only for mocking and testing. - ExternalTextureBase(DeviceBase* device); + explicit ExternalTextureBase(DeviceBase* device); void DestroyImpl() override; ~ExternalTextureBase() override; diff --git a/src/dawn/native/PerStage.h b/src/dawn/native/PerStage.h index 266bf92b4d..43fbb74338 100644 --- a/src/dawn/native/PerStage.h +++ b/src/dawn/native/PerStage.h @@ -49,7 +49,7 @@ namespace dawn::native { class PerStage { public: PerStage() = default; - PerStage(const T& initialValue) { + explicit PerStage(const T& initialValue) { mData.fill(initialValue); } diff --git a/src/dawn/native/PersistentCache.h b/src/dawn/native/PersistentCache.h index e112449e71..24aa9d0ac5 100644 --- a/src/dawn/native/PersistentCache.h +++ b/src/dawn/native/PersistentCache.h @@ -43,7 +43,7 @@ namespace dawn::native { // protected by mMutex. class PersistentCache { public: - PersistentCache(DeviceBase* device); + explicit PersistentCache(DeviceBase* device); // Combines load/store operations into a single call. // If the load was successful, a non-empty blob is returned to the caller. diff --git a/src/dawn/native/Pipeline.h b/src/dawn/native/Pipeline.h index a0e5c05369..4fffac5376 100644 --- a/src/dawn/native/Pipeline.h +++ b/src/dawn/native/Pipeline.h @@ -81,7 +81,7 @@ namespace dawn::native { PipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag); // Constructor used only for mocking and testing. - PipelineBase(DeviceBase* device); + explicit PipelineBase(DeviceBase* device); private: MaybeError ValidateGetBindGroupLayout(uint32_t group); diff --git a/src/dawn/native/PipelineLayout.h b/src/dawn/native/PipelineLayout.h index e15a0e31f7..634c082aa1 100644 --- a/src/dawn/native/PipelineLayout.h +++ b/src/dawn/native/PipelineLayout.h @@ -84,7 +84,7 @@ namespace dawn::native { protected: // Constructor used only for mocking and testing. - PipelineLayoutBase(DeviceBase* device); + explicit PipelineLayoutBase(DeviceBase* device); PipelineLayoutBase(DeviceBase* device, ObjectBase::ErrorTag tag); void DestroyImpl() override; diff --git a/src/dawn/native/PooledResourceMemoryAllocator.h b/src/dawn/native/PooledResourceMemoryAllocator.h index 184613a2d0..04d41ba433 100644 --- a/src/dawn/native/PooledResourceMemoryAllocator.h +++ b/src/dawn/native/PooledResourceMemoryAllocator.h @@ -30,7 +30,7 @@ namespace dawn::native { // the pool and made AVAILABLE. class PooledResourceMemoryAllocator : public ResourceHeapAllocator { public: - PooledResourceMemoryAllocator(ResourceHeapAllocator* heapAllocator); + explicit PooledResourceMemoryAllocator(ResourceHeapAllocator* heapAllocator); ~PooledResourceMemoryAllocator() override = default; ResultOrError> AllocateResourceHeap( diff --git a/src/dawn/native/QuerySet.cpp b/src/dawn/native/QuerySet.cpp index 3f20dab9de..0e5f90eb61 100644 --- a/src/dawn/native/QuerySet.cpp +++ b/src/dawn/native/QuerySet.cpp @@ -27,7 +27,7 @@ namespace dawn::native { class ErrorQuerySet final : public QuerySetBase { public: - ErrorQuerySet(DeviceBase* device) : QuerySetBase(device, ObjectBase::kError) { + explicit ErrorQuerySet(DeviceBase* device) : QuerySetBase(device, ObjectBase::kError) { } private: diff --git a/src/dawn/native/QuerySet.h b/src/dawn/native/QuerySet.h index 72ad861709..f65972df02 100644 --- a/src/dawn/native/QuerySet.h +++ b/src/dawn/native/QuerySet.h @@ -48,7 +48,7 @@ namespace dawn::native { QuerySetBase(DeviceBase* device, ObjectBase::ErrorTag tag); // Constructor used only for mocking and testing. - QuerySetBase(DeviceBase* device); + explicit QuerySetBase(DeviceBase* device); void DestroyImpl() override; ~QuerySetBase() override; diff --git a/src/dawn/native/Queue.cpp b/src/dawn/native/Queue.cpp index e9b5caf2fb..919f554c9c 100644 --- a/src/dawn/native/Queue.cpp +++ b/src/dawn/native/Queue.cpp @@ -154,7 +154,7 @@ namespace dawn::native { class ErrorQueue : public QueueBase { public: - ErrorQueue(DeviceBase* device) : QueueBase(device, ObjectBase::kError) { + explicit ErrorQueue(DeviceBase* device) : QueueBase(device, ObjectBase::kError) { } private: diff --git a/src/dawn/native/RenderPipeline.cpp b/src/dawn/native/RenderPipeline.cpp index 8af35544fc..c3410047b5 100644 --- a/src/dawn/native/RenderPipeline.cpp +++ b/src/dawn/native/RenderPipeline.cpp @@ -655,7 +655,7 @@ namespace dawn::native { RenderPipelineBase* RenderPipelineBase::MakeError(DeviceBase* device) { class ErrorRenderPipeline final : public RenderPipelineBase { public: - ErrorRenderPipeline(DeviceBase* device) + explicit ErrorRenderPipeline(DeviceBase* device) : RenderPipelineBase(device, ObjectBase::kError) { } diff --git a/src/dawn/native/RenderPipeline.h b/src/dawn/native/RenderPipeline.h index 56d482fba1..9a3c8c5165 100644 --- a/src/dawn/native/RenderPipeline.h +++ b/src/dawn/native/RenderPipeline.h @@ -112,7 +112,7 @@ namespace dawn::native { protected: // Constructor used only for mocking and testing. - RenderPipelineBase(DeviceBase* device); + explicit RenderPipelineBase(DeviceBase* device); void DestroyImpl() override; private: diff --git a/src/dawn/native/Sampler.h b/src/dawn/native/Sampler.h index 5b3823c023..73391a1c6d 100644 --- a/src/dawn/native/Sampler.h +++ b/src/dawn/native/Sampler.h @@ -56,7 +56,7 @@ namespace dawn::native { protected: // Constructor used only for mocking and testing. - SamplerBase(DeviceBase* device); + explicit SamplerBase(DeviceBase* device); void DestroyImpl() override; private: diff --git a/src/dawn/native/ShaderModule.cpp b/src/dawn/native/ShaderModule.cpp index 136158b443..da4959e382 100644 --- a/src/dawn/native/ShaderModule.cpp +++ b/src/dawn/native/ShaderModule.cpp @@ -974,7 +974,7 @@ namespace dawn::native { class TintSource { public: template - TintSource(ARGS&&... args) : file(std::forward(args)...) { + explicit TintSource(ARGS&&... args) : file(std::forward(args)...) { } tint::Source::File file; diff --git a/src/dawn/native/ShaderModule.h b/src/dawn/native/ShaderModule.h index bd69e5d730..e69082146b 100644 --- a/src/dawn/native/ShaderModule.h +++ b/src/dawn/native/ShaderModule.h @@ -284,7 +284,7 @@ namespace dawn::native { protected: // Constructor used only for mocking and testing. - ShaderModuleBase(DeviceBase* device); + explicit ShaderModuleBase(DeviceBase* device); void DestroyImpl() override; MaybeError InitializeBase(ShaderModuleParseResult* parseResult); diff --git a/src/dawn/native/StagingBuffer.h b/src/dawn/native/StagingBuffer.h index eafc78d0c8..4bda9c665e 100644 --- a/src/dawn/native/StagingBuffer.h +++ b/src/dawn/native/StagingBuffer.h @@ -21,7 +21,7 @@ namespace dawn::native { class StagingBufferBase { public: - StagingBufferBase(size_t size); + explicit StagingBufferBase(size_t size); virtual ~StagingBufferBase() = default; virtual MaybeError Initialize() = 0; diff --git a/src/dawn/native/SwapChain.cpp b/src/dawn/native/SwapChain.cpp index 1bd5fd707f..a2e735a5ed 100644 --- a/src/dawn/native/SwapChain.cpp +++ b/src/dawn/native/SwapChain.cpp @@ -28,7 +28,8 @@ namespace dawn::native { class ErrorSwapChain final : public SwapChainBase { public: - ErrorSwapChain(DeviceBase* device) : SwapChainBase(device, ObjectBase::kError) { + explicit ErrorSwapChain(DeviceBase* device) + : SwapChainBase(device, ObjectBase::kError) { } private: diff --git a/src/dawn/native/SwapChain.h b/src/dawn/native/SwapChain.h index 7c7d95c6dc..24f12e4f79 100644 --- a/src/dawn/native/SwapChain.h +++ b/src/dawn/native/SwapChain.h @@ -32,7 +32,7 @@ namespace dawn::native { class SwapChainBase : public ApiObjectBase { public: - SwapChainBase(DeviceBase* device); + explicit SwapChainBase(DeviceBase* device); static SwapChainBase* MakeError(DeviceBase* device); diff --git a/src/dawn/native/Texture.h b/src/dawn/native/Texture.h index 8b2210b403..c2f14cf5de 100644 --- a/src/dawn/native/Texture.h +++ b/src/dawn/native/Texture.h @@ -145,7 +145,7 @@ namespace dawn::native { protected: // Constructor used only for mocking and testing. - TextureViewBase(TextureBase* texture); + explicit TextureViewBase(TextureBase* texture); void DestroyImpl() override; private: diff --git a/src/dawn/native/TintUtils.h b/src/dawn/native/TintUtils.h index e3f6c3ab0b..e7a8fa7a6c 100644 --- a/src/dawn/native/TintUtils.h +++ b/src/dawn/native/TintUtils.h @@ -25,7 +25,7 @@ namespace dawn::native { // reported to the given device. class ScopedTintICEHandler : public NonCopyable { public: - ScopedTintICEHandler(DeviceBase* device); + explicit ScopedTintICEHandler(DeviceBase* device); ~ScopedTintICEHandler(); private: diff --git a/src/dawn/native/metal/BackendMTL.h b/src/dawn/native/metal/BackendMTL.h index 16f8843184..88608da447 100644 --- a/src/dawn/native/metal/BackendMTL.h +++ b/src/dawn/native/metal/BackendMTL.h @@ -21,7 +21,7 @@ namespace dawn::native::metal { class Backend : public BackendConnection { public: - Backend(InstanceBase* instance); + explicit Backend(InstanceBase* instance); std::vector> DiscoverDefaultAdapters() override; ResultOrError>> DiscoverAdapters( diff --git a/src/dawn/native/null/DeviceNull.cpp b/src/dawn/native/null/DeviceNull.cpp index b1ae053ed8..8c61c23d0d 100644 --- a/src/dawn/native/null/DeviceNull.cpp +++ b/src/dawn/native/null/DeviceNull.cpp @@ -68,7 +68,8 @@ namespace dawn::native::null { class Backend : public BackendConnection { public: - Backend(InstanceBase* instance) : BackendConnection(instance, wgpu::BackendType::Null) { + explicit Backend(InstanceBase* instance) + : BackendConnection(instance, wgpu::BackendType::Null) { } std::vector> DiscoverDefaultAdapters() override { diff --git a/src/dawn/native/null/DeviceNull.h b/src/dawn/native/null/DeviceNull.h index 38b6ca9385..299f44a8f2 100644 --- a/src/dawn/native/null/DeviceNull.h +++ b/src/dawn/native/null/DeviceNull.h @@ -168,7 +168,7 @@ namespace dawn::native::null { class Adapter : public AdapterBase { public: - Adapter(InstanceBase* instance); + explicit Adapter(InstanceBase* instance); ~Adapter() override; // AdapterBase Implementation diff --git a/src/dawn/native/utils/WGPUHelpers.h b/src/dawn/native/utils/WGPUHelpers.h index e895905be8..c46c3be026 100644 --- a/src/dawn/native/utils/WGPUHelpers.h +++ b/src/dawn/native/utils/WGPUHelpers.h @@ -74,7 +74,7 @@ namespace dawn::native::utils { wgpu::TextureFormat format, wgpu::TextureViewDimension viewDimension = wgpu::TextureViewDimension::e2D); - BindingLayoutEntryInitializationHelper(const BindGroupLayoutEntry& entry); + explicit BindingLayoutEntryInitializationHelper(const BindGroupLayoutEntry& entry); }; ResultOrError> MakeBindGroupLayout( diff --git a/src/dawn/native/vulkan/BackendVk.h b/src/dawn/native/vulkan/BackendVk.h index 533f1cf814..15c558a5f4 100644 --- a/src/dawn/native/vulkan/BackendVk.h +++ b/src/dawn/native/vulkan/BackendVk.h @@ -68,7 +68,7 @@ namespace dawn::native::vulkan { class Backend : public BackendConnection { public: - Backend(InstanceBase* instance); + explicit Backend(InstanceBase* instance); ~Backend() override; MaybeError Initialize(); diff --git a/src/dawn/native/vulkan/FencedDeleter.h b/src/dawn/native/vulkan/FencedDeleter.h index b8f9b133a4..aefea7e38b 100644 --- a/src/dawn/native/vulkan/FencedDeleter.h +++ b/src/dawn/native/vulkan/FencedDeleter.h @@ -25,7 +25,7 @@ namespace dawn::native::vulkan { class FencedDeleter { public: - FencedDeleter(Device* device); + explicit FencedDeleter(Device* device); ~FencedDeleter(); void DeleteWhenUnused(VkBuffer buffer); diff --git a/src/dawn/native/vulkan/RenderPassCache.h b/src/dawn/native/vulkan/RenderPassCache.h index 6565b0d8f1..9e46d40871 100644 --- a/src/dawn/native/vulkan/RenderPassCache.h +++ b/src/dawn/native/vulkan/RenderPassCache.h @@ -76,7 +76,7 @@ namespace dawn::native::vulkan { // TODO(cwallez@chromium.org): Make it an LRU cache somehow? class RenderPassCache { public: - RenderPassCache(Device* device); + explicit RenderPassCache(Device* device); ~RenderPassCache(); ResultOrError GetRenderPass(const RenderPassCacheQuery& query); diff --git a/src/dawn/native/vulkan/ResourceMemoryAllocatorVk.h b/src/dawn/native/vulkan/ResourceMemoryAllocatorVk.h index 0cd127cec9..c846ed9f42 100644 --- a/src/dawn/native/vulkan/ResourceMemoryAllocatorVk.h +++ b/src/dawn/native/vulkan/ResourceMemoryAllocatorVk.h @@ -39,7 +39,7 @@ namespace dawn::native::vulkan { class ResourceMemoryAllocator { public: - ResourceMemoryAllocator(Device* device); + explicit ResourceMemoryAllocator(Device* device); ~ResourceMemoryAllocator(); ResultOrError Allocate(const VkMemoryRequirements& requirements, diff --git a/src/dawn/native/vulkan/VulkanFunctions.h b/src/dawn/native/vulkan/VulkanFunctions.h index 84c58acf58..447c98d183 100644 --- a/src/dawn/native/vulkan/VulkanFunctions.h +++ b/src/dawn/native/vulkan/VulkanFunctions.h @@ -319,7 +319,7 @@ namespace dawn::native::vulkan { private: // Private. Use VkResult::WrapUnsafe instead. - constexpr VkResult(::VkResult value) : mValue(value) { + explicit constexpr VkResult(::VkResult value) : mValue(value) { } ::VkResult mValue; diff --git a/src/dawn/platform/WorkerThread.cpp b/src/dawn/platform/WorkerThread.cpp index 8ecbc58922..ea1c26eb7b 100644 --- a/src/dawn/platform/WorkerThread.cpp +++ b/src/dawn/platform/WorkerThread.cpp @@ -53,8 +53,7 @@ namespace { class AsyncWaitableEvent final : public dawn::platform::WaitableEvent { public: - explicit AsyncWaitableEvent() - : mWaitableEventImpl(std::make_shared()) { + AsyncWaitableEvent() : mWaitableEventImpl(std::make_shared()) { } void Wait() override { diff --git a/src/dawn/utils/TerribleCommandBuffer.h b/src/dawn/utils/TerribleCommandBuffer.h index 2f4acc4fac..cf6520bd6e 100644 --- a/src/dawn/utils/TerribleCommandBuffer.h +++ b/src/dawn/utils/TerribleCommandBuffer.h @@ -22,7 +22,7 @@ namespace utils { class TerribleCommandBuffer : public dawn::wire::CommandSerializer { public: TerribleCommandBuffer(); - TerribleCommandBuffer(dawn::wire::CommandHandler* handler); + explicit TerribleCommandBuffer(dawn::wire::CommandHandler* handler); void SetHandler(dawn::wire::CommandHandler* handler); diff --git a/src/dawn/wire/ChunkedCommandSerializer.h b/src/dawn/wire/ChunkedCommandSerializer.h index d71f864883..363d2990c2 100644 --- a/src/dawn/wire/ChunkedCommandSerializer.h +++ b/src/dawn/wire/ChunkedCommandSerializer.h @@ -28,7 +28,7 @@ namespace dawn::wire { class ChunkedCommandSerializer { public: - ChunkedCommandSerializer(CommandSerializer* serializer); + explicit ChunkedCommandSerializer(CommandSerializer* serializer); template void SerializeCommand(const Cmd& cmd) { diff --git a/src/dawn/wire/server/ServerMemoryTransferService_mock.h b/src/dawn/wire/server/ServerMemoryTransferService_mock.h index 4f23bfc860..6cc72a695f 100644 --- a/src/dawn/wire/server/ServerMemoryTransferService_mock.h +++ b/src/dawn/wire/server/ServerMemoryTransferService_mock.h @@ -26,7 +26,7 @@ namespace dawn::wire::server { public: class MockReadHandle : public ReadHandle { public: - MockReadHandle(MockMemoryTransferService* service); + explicit MockReadHandle(MockMemoryTransferService* service); ~MockReadHandle() override; size_t SizeOfSerializeDataUpdate(size_t offset, size_t size) override; @@ -41,7 +41,7 @@ namespace dawn::wire::server { class MockWriteHandle : public WriteHandle { public: - MockWriteHandle(MockMemoryTransferService* service); + explicit MockWriteHandle(MockMemoryTransferService* service); ~MockWriteHandle() override; bool DeserializeDataUpdate(const void* deserializePointer,