From 012098a86be89ad1d879d1531d79b4c8d4b25666 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Tue, 12 Apr 2022 17:43:21 +0000 Subject: [PATCH] Add explicit in include/dawn This CL adds some explicit notations to single argument constructors in the include/dawn folder. Bug: dawn:1339 Change-Id: Ie4e31bf68f920acfcfb27828a465e45fe0977af6 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86443 Auto-Submit: Dan Sinclair Kokoro: Kokoro Reviewed-by: Ben Clayton Commit-Queue: Dan Sinclair --- include/dawn/CPPLINT.cfg | 1 - include/dawn/EnumClassBitmasks.h | 1 + include/dawn/native/D3D12Backend.h | 2 +- include/dawn/native/DawnNative.h | 7 ++++--- include/dawn/wire/WireClient.h | 2 +- include/dawn/wire/WireServer.h | 2 +- src/dawn/native/DawnNative.cpp | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/dawn/CPPLINT.cfg b/include/dawn/CPPLINT.cfg index cab84f8002..c2e9bca07b 100644 --- a/include/dawn/CPPLINT.cfg +++ b/include/dawn/CPPLINT.cfg @@ -1,4 +1,3 @@ filter=-build/include_order filter=-readability/inheritance -filter=-runtime/explicit filter=-runtime/indentation_namespace diff --git a/include/dawn/EnumClassBitmasks.h b/include/dawn/EnumClassBitmasks.h index e5272f308b..7bfe4ecc5c 100644 --- a/include/dawn/EnumClassBitmasks.h +++ b/include/dawn/EnumClassBitmasks.h @@ -54,6 +54,7 @@ namespace dawn { struct BoolConvertible { using Integral = typename std::underlying_type::type; + // NOLINTNEXTLINE(runtime/explicit) constexpr BoolConvertible(Integral value) : value(value) { } constexpr operator bool() const { diff --git a/include/dawn/native/D3D12Backend.h b/include/dawn/native/D3D12Backend.h index 599921bab0..99a6c62702 100644 --- a/include/dawn/native/D3D12Backend.h +++ b/include/dawn/native/D3D12Backend.h @@ -101,7 +101,7 @@ namespace dawn::native::d3d12 { struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptions : public AdapterDiscoveryOptionsBase { AdapterDiscoveryOptions(); - AdapterDiscoveryOptions(Microsoft::WRL::ComPtr adapter); + explicit AdapterDiscoveryOptions(Microsoft::WRL::ComPtr adapter); Microsoft::WRL::ComPtr dxgiAdapter; }; diff --git a/include/dawn/native/DawnNative.h b/include/dawn/native/DawnNative.h index d6ccaca521..dc54dedac2 100644 --- a/include/dawn/native/DawnNative.h +++ b/include/dawn/native/DawnNative.h @@ -69,6 +69,7 @@ namespace dawn::native { class DAWN_NATIVE_EXPORT Adapter { public: Adapter(); + // NOLINTNEXTLINE(runtime/explicit) Adapter(AdapterBase* impl); ~Adapter(); @@ -124,7 +125,7 @@ namespace dawn::native { const WGPUBackendType backendType; protected: - AdapterDiscoveryOptionsBase(WGPUBackendType type); + explicit AdapterDiscoveryOptionsBase(WGPUBackendType type); }; enum BackendValidationLevel { Full, Partial, Disabled }; @@ -222,7 +223,7 @@ namespace dawn::native { ExternalImageType GetType() const; protected: - ExternalImageDescriptor(ExternalImageType type); + explicit ExternalImageDescriptor(ExternalImageType type); private: ExternalImageType mType; @@ -240,7 +241,7 @@ namespace dawn::native { ExternalImageType GetType() const; protected: - ExternalImageExportInfo(ExternalImageType type); + explicit ExternalImageExportInfo(ExternalImageType type); private: ExternalImageType mType; diff --git a/include/dawn/wire/WireClient.h b/include/dawn/wire/WireClient.h index ddda1d302c..7771188759 100644 --- a/include/dawn/wire/WireClient.h +++ b/include/dawn/wire/WireClient.h @@ -65,7 +65,7 @@ namespace dawn::wire { class DAWN_WIRE_EXPORT WireClient : public CommandHandler { public: - WireClient(const WireClientDescriptor& descriptor); + explicit WireClient(const WireClientDescriptor& descriptor); ~WireClient() override; const volatile char* HandleCommands(const volatile char* commands, diff --git a/include/dawn/wire/WireServer.h b/include/dawn/wire/WireServer.h index 2e37446e25..7c8fb56258 100644 --- a/include/dawn/wire/WireServer.h +++ b/include/dawn/wire/WireServer.h @@ -36,7 +36,7 @@ namespace dawn::wire { class DAWN_WIRE_EXPORT WireServer : public CommandHandler { public: - WireServer(const WireServerDescriptor& descriptor); + explicit WireServer(const WireServerDescriptor& descriptor); ~WireServer() override; const volatile char* HandleCommands(const volatile char* commands, diff --git a/src/dawn/native/DawnNative.cpp b/src/dawn/native/DawnNative.cpp index 6a139a5cff..1785c6d651 100644 --- a/src/dawn/native/DawnNative.cpp +++ b/src/dawn/native/DawnNative.cpp @@ -210,7 +210,7 @@ namespace dawn::native { // Adapters are owned by mImpl so it is safe to return non RAII pointers to them std::vector adapters; for (const Ref& adapter : mImpl->GetAdapters()) { - adapters.push_back({adapter.Get()}); + adapters.push_back(Adapter(adapter.Get())); } return adapters; }