From d84daed72c8fb790cd519510bd5adb75afcae0b8 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Mon, 9 May 2022 16:26:44 +0000 Subject: [PATCH] [chromium-style] Fixup a few chromium-style issues. This CL fixes a few missing overrides and updates some `auto`'s to have a `*` on them. Bug: dawn:1405 Change-Id: I621cd35fb10d8308a5831db11c22a3595e52e295 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89120 Reviewed-by: Ben Clayton Auto-Submit: Dan Sinclair Commit-Queue: Dan Sinclair Kokoro: Kokoro Reviewed-by: Austin Eng --- src/dawn/native/Adapter.h | 2 +- src/dawn/native/Instance.h | 2 +- src/dawn/native/PassResourceUsageTracker.cpp | 2 +- src/dawn/native/vulkan/BackendVk.h | 2 +- src/dawn/native/vulkan/DescriptorSetAllocator.h | 2 +- src/dawn/native/vulkan/ResourceHeapVk.h | 2 +- src/dawn/tests/DawnTest.h | 2 +- src/dawn/tests/end2end/OpArrayLengthTests.cpp | 2 +- src/dawn/tests/unittests/RefCountedTests.cpp | 4 ++-- src/dawn/tests/unittests/StackContainerTests.cpp | 2 +- src/dawn/tests/unittests/ToBackendTests.cpp | 4 ++-- src/dawn/tests/unittests/validation/ValidationTest.cpp | 4 ++-- src/dawn/wire/WireDeserializeAllocator.cpp | 2 +- src/dawn/wire/client/Client.cpp | 2 +- src/dawn/wire/client/Device.cpp | 5 +++-- 15 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/dawn/native/Adapter.h b/src/dawn/native/Adapter.h index 9a1b24f86b..d39000e359 100644 --- a/src/dawn/native/Adapter.h +++ b/src/dawn/native/Adapter.h @@ -33,7 +33,7 @@ class DeviceBase; class AdapterBase : public RefCounted { public: AdapterBase(InstanceBase* instance, wgpu::BackendType backend); - virtual ~AdapterBase() = default; + ~AdapterBase() override = default; MaybeError Initialize(); diff --git a/src/dawn/native/Instance.h b/src/dawn/native/Instance.h index 578ee695b1..6f8f5d5ef5 100644 --- a/src/dawn/native/Instance.h +++ b/src/dawn/native/Instance.h @@ -94,7 +94,7 @@ class InstanceBase final : public RefCounted { private: InstanceBase() = default; - ~InstanceBase() = default; + ~InstanceBase() override = default; InstanceBase(const InstanceBase& other) = delete; InstanceBase& operator=(const InstanceBase& other) = delete; diff --git a/src/dawn/native/PassResourceUsageTracker.cpp b/src/dawn/native/PassResourceUsageTracker.cpp index f6c56a2ee2..2c476cc124 100644 --- a/src/dawn/native/PassResourceUsageTracker.cpp +++ b/src/dawn/native/PassResourceUsageTracker.cpp @@ -154,7 +154,7 @@ SyncScopeResourceUsage SyncScopeUsageTracker::AcquireSyncScopeUsage() { result.textureUsages.push_back(std::move(usage)); } - for (auto& it : mExternalTextureUsages) { + for (auto* const it : mExternalTextureUsages) { result.externalTextures.push_back(it); } diff --git a/src/dawn/native/vulkan/BackendVk.h b/src/dawn/native/vulkan/BackendVk.h index 7b3e430c03..f912344d31 100644 --- a/src/dawn/native/vulkan/BackendVk.h +++ b/src/dawn/native/vulkan/BackendVk.h @@ -48,7 +48,7 @@ class Device; class VulkanInstance : public RefCounted { public: static ResultOrError> Create(const InstanceBase* instance, ICD icd); - ~VulkanInstance(); + ~VulkanInstance() override; const VulkanFunctions& GetFunctions() const; VkInstance GetVkInstance() const; diff --git a/src/dawn/native/vulkan/DescriptorSetAllocator.h b/src/dawn/native/vulkan/DescriptorSetAllocator.h index c9060fe9d5..98664374a6 100644 --- a/src/dawn/native/vulkan/DescriptorSetAllocator.h +++ b/src/dawn/native/vulkan/DescriptorSetAllocator.h @@ -45,7 +45,7 @@ class DescriptorSetAllocator : public ObjectBase { private: DescriptorSetAllocator(BindGroupLayout* layout, std::map descriptorCountPerType); - ~DescriptorSetAllocator(); + ~DescriptorSetAllocator() override; MaybeError AllocateDescriptorPool(); diff --git a/src/dawn/native/vulkan/ResourceHeapVk.h b/src/dawn/native/vulkan/ResourceHeapVk.h index a148334a1e..d1c2d4aa12 100644 --- a/src/dawn/native/vulkan/ResourceHeapVk.h +++ b/src/dawn/native/vulkan/ResourceHeapVk.h @@ -24,7 +24,7 @@ namespace dawn::native::vulkan { class ResourceHeap : public ResourceHeapBase { public: ResourceHeap(VkDeviceMemory memory, size_t memoryType); - ~ResourceHeap() = default; + ~ResourceHeap() override = default; VkDeviceMemory GetMemory() const; size_t GetMemoryType() const; diff --git a/src/dawn/tests/DawnTest.h b/src/dawn/tests/DawnTest.h index bcd83e4be6..8bc57a2d34 100644 --- a/src/dawn/tests/DawnTest.h +++ b/src/dawn/tests/DawnTest.h @@ -790,7 +790,7 @@ extern template class ExpectBetweenColors; class CustomTextureExpectation : public Expectation { public: - virtual ~CustomTextureExpectation() = default; + ~CustomTextureExpectation() override = default; virtual uint32_t DataSize() = 0; }; diff --git a/src/dawn/tests/end2end/OpArrayLengthTests.cpp b/src/dawn/tests/end2end/OpArrayLengthTests.cpp index a00ca3211b..dcd3528e0f 100644 --- a/src/dawn/tests/end2end/OpArrayLengthTests.cpp +++ b/src/dawn/tests/end2end/OpArrayLengthTests.cpp @@ -21,7 +21,7 @@ class OpArrayLengthTest : public DawnTest { protected: - void SetUp() { + void SetUp() override { DawnTest::SetUp(); // Create buffers of various size to check the length() implementation diff --git a/src/dawn/tests/unittests/RefCountedTests.cpp b/src/dawn/tests/unittests/RefCountedTests.cpp index a1c5fca00f..d8a37a5016 100644 --- a/src/dawn/tests/unittests/RefCountedTests.cpp +++ b/src/dawn/tests/unittests/RefCountedTests.cpp @@ -45,7 +45,7 @@ struct RCTestDerived : public RCTest { // Test that RCs start with one ref, and removing it destroys the object. TEST(RefCounted, StartsWithOneRef) { bool deleted = false; - auto test = new RCTest(&deleted); + auto* test = new RCTest(&deleted); test->Release(); EXPECT_TRUE(deleted); @@ -54,7 +54,7 @@ TEST(RefCounted, StartsWithOneRef) { // Test adding refs keep the RC alive. TEST(RefCounted, AddingRefKeepsAlive) { bool deleted = false; - auto test = new RCTest(&deleted); + auto* test = new RCTest(&deleted); test->Reference(); test->Release(); diff --git a/src/dawn/tests/unittests/StackContainerTests.cpp b/src/dawn/tests/unittests/StackContainerTests.cpp index 432533237c..b206187c5a 100644 --- a/src/dawn/tests/unittests/StackContainerTests.cpp +++ b/src/dawn/tests/unittests/StackContainerTests.cpp @@ -19,7 +19,7 @@ class Placeholder : public RefCounted { explicit Placeholder(int* alive) : mAlive(alive) { ++*mAlive; } private: - ~Placeholder() { --*mAlive; } + ~Placeholder() override { --*mAlive; } int* const mAlive; }; diff --git a/src/dawn/tests/unittests/ToBackendTests.cpp b/src/dawn/tests/unittests/ToBackendTests.cpp index 8d64fce736..91c4b66826 100644 --- a/src/dawn/tests/unittests/ToBackendTests.cpp +++ b/src/dawn/tests/unittests/ToBackendTests.cpp @@ -41,7 +41,7 @@ TEST(ToBackend, Pointers) { MyAdapter* adapter = new MyAdapter; const AdapterBase* base = adapter; - auto backendAdapter = ToBackend(base); + auto* backendAdapter = ToBackend(base); static_assert(std::is_same::value); ASSERT_EQ(adapter, backendAdapter); @@ -51,7 +51,7 @@ TEST(ToBackend, Pointers) { MyAdapter* adapter = new MyAdapter; AdapterBase* base = adapter; - auto backendAdapter = ToBackend(base); + auto* backendAdapter = ToBackend(base); static_assert(std::is_same::value); ASSERT_EQ(adapter, backendAdapter); diff --git a/src/dawn/tests/unittests/validation/ValidationTest.cpp b/src/dawn/tests/unittests/validation/ValidationTest.cpp index b7b23b2483..38908b5388 100644 --- a/src/dawn/tests/unittests/validation/ValidationTest.cpp +++ b/src/dawn/tests/unittests/validation/ValidationTest.cpp @@ -229,7 +229,7 @@ WGPUDevice ValidationTest::CreateTestDevice() { // static void ValidationTest::OnDeviceError(WGPUErrorType type, const char* message, void* userdata) { ASSERT(type != WGPUErrorType_NoError); - auto self = static_cast(userdata); + auto* self = static_cast(userdata); self->mDeviceErrorMessage = message; ASSERT_TRUE(self->mExpectError) << "Got unexpected device error: " << message; @@ -243,7 +243,7 @@ void ValidationTest::OnDeviceError(WGPUErrorType type, const char* message, void void ValidationTest::OnDeviceLost(WGPUDeviceLostReason reason, const char* message, void* userdata) { - auto self = static_cast(userdata); + auto* self = static_cast(userdata); if (self->mExpectDestruction) { EXPECT_EQ(reason, WGPUDeviceLostReason_Destroyed); return; diff --git a/src/dawn/wire/WireDeserializeAllocator.cpp b/src/dawn/wire/WireDeserializeAllocator.cpp index 95fb5f0e02..9e4fadc512 100644 --- a/src/dawn/wire/WireDeserializeAllocator.cpp +++ b/src/dawn/wire/WireDeserializeAllocator.cpp @@ -48,7 +48,7 @@ void* WireDeserializeAllocator::GetSpace(size_t size) { } void WireDeserializeAllocator::Reset() { - for (auto allocation : mAllocations) { + for (auto* allocation : mAllocations) { free(allocation); } mAllocations.clear(); diff --git a/src/dawn/wire/client/Client.cpp b/src/dawn/wire/client/Client.cpp index 6b15628695..71365474f7 100644 --- a/src/dawn/wire/client/Client.cpp +++ b/src/dawn/wire/client/Client.cpp @@ -28,7 +28,7 @@ class NoopCommandSerializer final : public CommandSerializer { return &gNoopCommandSerializer; } - ~NoopCommandSerializer() = default; + ~NoopCommandSerializer() override = default; size_t GetMaximumAllocationSize() const final { return 0; } void* GetCmdSpace(size_t size) final { return nullptr; } diff --git a/src/dawn/wire/client/Device.cpp b/src/dawn/wire/client/Device.cpp index b672d397d1..99a5eb5f44 100644 --- a/src/dawn/wire/client/Device.cpp +++ b/src/dawn/wire/client/Device.cpp @@ -254,7 +254,7 @@ bool Device::OnCreateComputePipelineAsyncCallback(uint64_t requestSerial, return false; } - auto pipelineAllocation = + auto* pipelineAllocation = client->ComputePipelineAllocator().GetObject(request.pipelineObjectID); // If the return status is a failure we should give a null pipeline to the callback and @@ -305,7 +305,8 @@ bool Device::OnCreateRenderPipelineAsyncCallback(uint64_t requestSerial, return false; } - auto pipelineAllocation = client->RenderPipelineAllocator().GetObject(request.pipelineObjectID); + auto* pipelineAllocation = + client->RenderPipelineAllocator().GetObject(request.pipelineObjectID); // If the return status is a failure we should give a null pipeline to the callback and // free the allocation.