Add explicit to test files.

This CL updates the test files to have explicit added for single
parameter constructors and removed from zero parameter constructors.

Bug: dawn:1339
Change-Id: I21339148bba5e7e89debc38ec426ba15e0d734e2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87021
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
dan sinclair 2022-04-19 08:28:34 +00:00 committed by Dawn LUCI CQ
parent 92bef59295
commit cccadddcb0
25 changed files with 31 additions and 30 deletions

View File

@ -273,7 +273,7 @@ class DawnTestBase {
friend class DawnPerfTestBase; friend class DawnPerfTestBase;
public: public:
DawnTestBase(const AdapterTestParam& param); explicit DawnTestBase(const AdapterTestParam& param);
virtual ~DawnTestBase(); virtual ~DawnTestBase();
void SetUp(); void SetUp();
@ -327,7 +327,7 @@ class DawnTestBase {
virtual std::unique_ptr<dawn::platform::Platform> CreateTestPlatform(); virtual std::unique_ptr<dawn::platform::Platform> CreateTestPlatform();
struct PrintToStringParamName { struct PrintToStringParamName {
PrintToStringParamName(const char* test); explicit PrintToStringParamName(const char* test);
std::string SanitizeParamName(std::string paramName, size_t index) const; std::string SanitizeParamName(std::string paramName, size_t index) const;
template <class ParamType> template <class ParamType>
@ -750,7 +750,7 @@ namespace detail {
template <typename T, typename U> template <typename T, typename U>
class ExpectEq : public Expectation { class ExpectEq : public Expectation {
public: public:
ExpectEq(T singleValue, T tolerance = {}); explicit ExpectEq(T singleValue, T tolerance = {});
ExpectEq(const T* values, const unsigned int count, T tolerance = {}); ExpectEq(const T* values, const unsigned int count, T tolerance = {});
testing::AssertionResult Check(const void* data, size_t size) override; testing::AssertionResult Check(const void* data, size_t size) override;

View File

@ -46,7 +46,7 @@ class ParamGenerator {
public: public:
using value_type = ParamStruct; using value_type = ParamStruct;
ParamGenerator(std::vector<Params>... params) : mParams(params...), mIsEmpty(false) { explicit ParamGenerator(std::vector<Params>... params) : mParams(params...), mIsEmpty(false) {
for (bool isEmpty : {params.empty()...}) { for (bool isEmpty : {params.empty()...}) {
mIsEmpty |= isEmpty; mIsEmpty |= isEmpty;
} }

View File

@ -74,7 +74,7 @@ class FakePersistentCache : public dawn::platform::CachingInterface {
// Test platform that only supports caching. // Test platform that only supports caching.
class DawnTestPlatform : public dawn::platform::Platform { class DawnTestPlatform : public dawn::platform::Platform {
public: public:
DawnTestPlatform(dawn::platform::CachingInterface* cachingInterface) explicit DawnTestPlatform(dawn::platform::CachingInterface* cachingInterface)
: mCachingInterface(cachingInterface) { : mCachingInterface(cachingInterface) {
} }
~DawnTestPlatform() override = default; ~DawnTestPlatform() override = default;

View File

@ -423,7 +423,7 @@ class DepthStencilSamplingTest : public DawnTestWithParams<DepthStencilSamplingT
using StencilData = std::array<uint32_t, 4>; using StencilData = std::array<uint32_t, 4>;
public: public:
ExtraStencilComponentsExpectation(uint32_t expected) : mExpected(expected) { explicit ExtraStencilComponentsExpectation(uint32_t expected) : mExpected(expected) {
} }
~ExtraStencilComponentsExpectation() override = default; ~ExtraStencilComponentsExpectation() override = default;

View File

@ -40,7 +40,7 @@ class OcclusionExpectation : public detail::Expectation {
~OcclusionExpectation() override = default; ~OcclusionExpectation() override = default;
OcclusionExpectation(Result expected) { explicit OcclusionExpectation(Result expected) {
mExpected = expected; mExpected = expected;
} }

View File

@ -76,7 +76,7 @@ class ExpectFloatWithTolerance : public detail::Expectation {
// An expectation for float16 buffers that can correctly compare NaNs (all NaNs are equivalent). // An expectation for float16 buffers that can correctly compare NaNs (all NaNs are equivalent).
class ExpectFloat16 : public detail::Expectation { class ExpectFloat16 : public detail::Expectation {
public: public:
ExpectFloat16(std::vector<uint16_t> expected) : mExpected(std::move(expected)) { explicit ExpectFloat16(std::vector<uint16_t> expected) : mExpected(std::move(expected)) {
} }
testing::AssertionResult Check(const void* data, size_t size) override { testing::AssertionResult Check(const void* data, size_t size) override {

View File

@ -22,10 +22,10 @@ class RCTest : public RefCounted {
RCTest() : RefCounted() { RCTest() : RefCounted() {
} }
RCTest(uint64_t payload) : RefCounted(payload) { explicit RCTest(uint64_t payload) : RefCounted(payload) {
} }
RCTest(bool* deleted) : mDeleted(deleted) { explicit RCTest(bool* deleted) : mDeleted(deleted) {
} }
~RCTest() override { ~RCTest() override {

View File

@ -20,7 +20,7 @@
namespace { namespace {
struct Foo : public PlacementAllocated { struct Foo : public PlacementAllocated {
Foo(int value) : value(value) { explicit Foo(int value) : value(value) {
} }
int value; int value;

View File

@ -90,7 +90,7 @@ struct FakeStorage {
// a single range (and that each subresource was seen only once). // a single range (and that each subresource was seen only once).
struct RangeTracker { struct RangeTracker {
template <typename T> template <typename T>
RangeTracker(const SubresourceStorage<T>& s) explicit RangeTracker(const SubresourceStorage<T>& s)
: mTracked(s.GetAspectsForTesting(), : mTracked(s.GetAspectsForTesting(),
s.GetArrayLayerCountForTesting(), s.GetArrayLayerCountForTesting(),
s.GetMipLevelCountForTesting(), s.GetMipLevelCountForTesting(),

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class BindGroupLayoutMock final : public BindGroupLayoutBase { class BindGroupLayoutMock final : public BindGroupLayoutBase {
public: public:
BindGroupLayoutMock(DeviceBase* device) : BindGroupLayoutBase(device) { explicit BindGroupLayoutMock(DeviceBase* device) : BindGroupLayoutBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() { ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->BindGroupLayoutBase::DestroyImpl(); this->BindGroupLayoutBase::DestroyImpl();
}); });

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class BindGroupMock : public BindGroupBase { class BindGroupMock : public BindGroupBase {
public: public:
BindGroupMock(DeviceBase* device) : BindGroupBase(device) { explicit BindGroupMock(DeviceBase* device) : BindGroupBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() { ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->BindGroupBase::DestroyImpl(); this->BindGroupBase::DestroyImpl();
}); });

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class CommandBufferMock : public CommandBufferBase { class CommandBufferMock : public CommandBufferBase {
public: public:
CommandBufferMock(DeviceBase* device) : CommandBufferBase(device) { explicit CommandBufferMock(DeviceBase* device) : CommandBufferBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() { ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->CommandBufferBase::DestroyImpl(); this->CommandBufferBase::DestroyImpl();
}); });

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class ComputePipelineMock : public ComputePipelineBase { class ComputePipelineMock : public ComputePipelineBase {
public: public:
ComputePipelineMock(DeviceBase* device) : ComputePipelineBase(device) { explicit ComputePipelineMock(DeviceBase* device) : ComputePipelineBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() { ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->ComputePipelineBase::DestroyImpl(); this->ComputePipelineBase::DestroyImpl();
}); });

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class ExternalTextureMock : public ExternalTextureBase { class ExternalTextureMock : public ExternalTextureBase {
public: public:
ExternalTextureMock(DeviceBase* device) : ExternalTextureBase(device) { explicit ExternalTextureMock(DeviceBase* device) : ExternalTextureBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() { ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->ExternalTextureBase::DestroyImpl(); this->ExternalTextureBase::DestroyImpl();
}); });

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class PipelineLayoutMock : public PipelineLayoutBase { class PipelineLayoutMock : public PipelineLayoutBase {
public: public:
PipelineLayoutMock(DeviceBase* device) : PipelineLayoutBase(device) { explicit PipelineLayoutMock(DeviceBase* device) : PipelineLayoutBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() { ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->PipelineLayoutBase::DestroyImpl(); this->PipelineLayoutBase::DestroyImpl();
}); });

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class QuerySetMock : public QuerySetBase { class QuerySetMock : public QuerySetBase {
public: public:
QuerySetMock(DeviceBase* device) : QuerySetBase(device) { explicit QuerySetMock(DeviceBase* device) : QuerySetBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() { ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->QuerySetBase::DestroyImpl(); this->QuerySetBase::DestroyImpl();
}); });

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class RenderPipelineMock : public RenderPipelineBase { class RenderPipelineMock : public RenderPipelineBase {
public: public:
RenderPipelineMock(DeviceBase* device) : RenderPipelineBase(device) { explicit RenderPipelineMock(DeviceBase* device) : RenderPipelineBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() { ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->RenderPipelineBase::DestroyImpl(); this->RenderPipelineBase::DestroyImpl();
}); });

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class SamplerMock : public SamplerBase { class SamplerMock : public SamplerBase {
public: public:
SamplerMock(DeviceBase* device) : SamplerBase(device) { explicit SamplerMock(DeviceBase* device) : SamplerBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() { ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->SamplerBase::DestroyImpl(); this->SamplerBase::DestroyImpl();
}); });

View File

@ -27,7 +27,7 @@ namespace dawn::native {
class ShaderModuleMock : public ShaderModuleBase { class ShaderModuleMock : public ShaderModuleBase {
public: public:
ShaderModuleMock(DeviceBase* device); explicit ShaderModuleMock(DeviceBase* device);
~ShaderModuleMock() override = default; ~ShaderModuleMock() override = default;
MOCK_METHOD(void, DestroyImpl, (), (override)); MOCK_METHOD(void, DestroyImpl, (), (override));

View File

@ -24,7 +24,7 @@ namespace dawn::native {
class SwapChainMock : public SwapChainBase { class SwapChainMock : public SwapChainBase {
public: public:
SwapChainMock(DeviceBase* device) : SwapChainBase(device) { explicit SwapChainMock(DeviceBase* device) : SwapChainBase(device) {
ON_CALL(*this, DestroyImpl).WillByDefault([this]() { ON_CALL(*this, DestroyImpl).WillByDefault([this]() {
this->SwapChainBase::DestroyImpl(); this->SwapChainBase::DestroyImpl();
}); });

View File

@ -37,7 +37,7 @@ namespace dawn::native {
class TextureViewMock : public TextureViewBase { class TextureViewMock : public TextureViewBase {
public: public:
TextureViewMock(TextureBase* texture) : TextureViewBase(texture) { explicit TextureViewMock(TextureBase* texture) : TextureViewBase(texture) {
} }
~TextureViewMock() override = default; ~TextureViewMock() override = default;

View File

@ -117,7 +117,7 @@ class ValidationTest : public testing::Test {
struct DummyRenderPass : public wgpu::RenderPassDescriptor { struct DummyRenderPass : public wgpu::RenderPassDescriptor {
public: public:
DummyRenderPass(const wgpu::Device& device); explicit DummyRenderPass(const wgpu::Device& device);
wgpu::Texture attachment; wgpu::Texture attachment;
wgpu::TextureFormat attachmentFormat; wgpu::TextureFormat attachmentFormat;
uint32_t width; uint32_t width;

View File

@ -71,7 +71,7 @@ inline testing::Matcher<MatcherLambdaArgument<Lambda>> MatchesLambda(Lambda lamb
class StringMessageMatcher : public testing::MatcherInterface<const char*> { class StringMessageMatcher : public testing::MatcherInterface<const char*> {
public: public:
explicit StringMessageMatcher() { StringMessageMatcher() {
} }
bool MatchAndExplain(const char* message, bool MatchAndExplain(const char* message,

View File

@ -30,7 +30,7 @@ namespace dawn::native::vulkan {
class ExternalSemaphoreDmaBuf : public VulkanImageWrappingTestBackend::ExternalSemaphore { class ExternalSemaphoreDmaBuf : public VulkanImageWrappingTestBackend::ExternalSemaphore {
public: public:
ExternalSemaphoreDmaBuf(int handle) : mHandle(handle) { explicit ExternalSemaphoreDmaBuf(int handle) : mHandle(handle) {
} }
~ExternalSemaphoreDmaBuf() override { ~ExternalSemaphoreDmaBuf() override {
if (mHandle != -1) { if (mHandle != -1) {
@ -77,7 +77,7 @@ namespace dawn::native::vulkan {
class VulkanImageWrappingTestBackendDmaBuf : public VulkanImageWrappingTestBackend { class VulkanImageWrappingTestBackendDmaBuf : public VulkanImageWrappingTestBackend {
public: public:
VulkanImageWrappingTestBackendDmaBuf(const wgpu::Device& device) { explicit VulkanImageWrappingTestBackendDmaBuf(const wgpu::Device& device) {
} }
~VulkanImageWrappingTestBackendDmaBuf() { ~VulkanImageWrappingTestBackendDmaBuf() {

View File

@ -32,7 +32,7 @@ namespace dawn::native::vulkan {
class ExternalSemaphoreOpaqueFD : public VulkanImageWrappingTestBackend::ExternalSemaphore { class ExternalSemaphoreOpaqueFD : public VulkanImageWrappingTestBackend::ExternalSemaphore {
public: public:
ExternalSemaphoreOpaqueFD(int handle) : mHandle(handle) { explicit ExternalSemaphoreOpaqueFD(int handle) : mHandle(handle) {
} }
~ExternalSemaphoreOpaqueFD() override { ~ExternalSemaphoreOpaqueFD() override {
if (mHandle != -1) { if (mHandle != -1) {
@ -94,7 +94,8 @@ namespace dawn::native::vulkan {
class VulkanImageWrappingTestBackendOpaqueFD : public VulkanImageWrappingTestBackend { class VulkanImageWrappingTestBackendOpaqueFD : public VulkanImageWrappingTestBackend {
public: public:
VulkanImageWrappingTestBackendOpaqueFD(const wgpu::Device& device) : mDevice(device) { explicit VulkanImageWrappingTestBackendOpaqueFD(const wgpu::Device& device)
: mDevice(device) {
mDeviceVk = dawn::native::vulkan::ToBackend(dawn::native::FromAPI(device.Get())); mDeviceVk = dawn::native::vulkan::ToBackend(dawn::native::FromAPI(device.Get()));
} }