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 <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2022-04-12 17:43:21 +00:00 committed by Dawn LUCI CQ
parent b2fdd6402d
commit 012098a86b
7 changed files with 9 additions and 8 deletions

View File

@ -1,4 +1,3 @@
filter=-build/include_order filter=-build/include_order
filter=-readability/inheritance filter=-readability/inheritance
filter=-runtime/explicit
filter=-runtime/indentation_namespace filter=-runtime/indentation_namespace

View File

@ -54,6 +54,7 @@ namespace dawn {
struct BoolConvertible { struct BoolConvertible {
using Integral = typename std::underlying_type<T>::type; using Integral = typename std::underlying_type<T>::type;
// NOLINTNEXTLINE(runtime/explicit)
constexpr BoolConvertible(Integral value) : value(value) { constexpr BoolConvertible(Integral value) : value(value) {
} }
constexpr operator bool() const { constexpr operator bool() const {

View File

@ -101,7 +101,7 @@ namespace dawn::native::d3d12 {
struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptions : public AdapterDiscoveryOptionsBase { struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptions : public AdapterDiscoveryOptionsBase {
AdapterDiscoveryOptions(); AdapterDiscoveryOptions();
AdapterDiscoveryOptions(Microsoft::WRL::ComPtr<IDXGIAdapter> adapter); explicit AdapterDiscoveryOptions(Microsoft::WRL::ComPtr<IDXGIAdapter> adapter);
Microsoft::WRL::ComPtr<IDXGIAdapter> dxgiAdapter; Microsoft::WRL::ComPtr<IDXGIAdapter> dxgiAdapter;
}; };

View File

@ -69,6 +69,7 @@ namespace dawn::native {
class DAWN_NATIVE_EXPORT Adapter { class DAWN_NATIVE_EXPORT Adapter {
public: public:
Adapter(); Adapter();
// NOLINTNEXTLINE(runtime/explicit)
Adapter(AdapterBase* impl); Adapter(AdapterBase* impl);
~Adapter(); ~Adapter();
@ -124,7 +125,7 @@ namespace dawn::native {
const WGPUBackendType backendType; const WGPUBackendType backendType;
protected: protected:
AdapterDiscoveryOptionsBase(WGPUBackendType type); explicit AdapterDiscoveryOptionsBase(WGPUBackendType type);
}; };
enum BackendValidationLevel { Full, Partial, Disabled }; enum BackendValidationLevel { Full, Partial, Disabled };
@ -222,7 +223,7 @@ namespace dawn::native {
ExternalImageType GetType() const; ExternalImageType GetType() const;
protected: protected:
ExternalImageDescriptor(ExternalImageType type); explicit ExternalImageDescriptor(ExternalImageType type);
private: private:
ExternalImageType mType; ExternalImageType mType;
@ -240,7 +241,7 @@ namespace dawn::native {
ExternalImageType GetType() const; ExternalImageType GetType() const;
protected: protected:
ExternalImageExportInfo(ExternalImageType type); explicit ExternalImageExportInfo(ExternalImageType type);
private: private:
ExternalImageType mType; ExternalImageType mType;

View File

@ -65,7 +65,7 @@ namespace dawn::wire {
class DAWN_WIRE_EXPORT WireClient : public CommandHandler { class DAWN_WIRE_EXPORT WireClient : public CommandHandler {
public: public:
WireClient(const WireClientDescriptor& descriptor); explicit WireClient(const WireClientDescriptor& descriptor);
~WireClient() override; ~WireClient() override;
const volatile char* HandleCommands(const volatile char* commands, const volatile char* HandleCommands(const volatile char* commands,

View File

@ -36,7 +36,7 @@ namespace dawn::wire {
class DAWN_WIRE_EXPORT WireServer : public CommandHandler { class DAWN_WIRE_EXPORT WireServer : public CommandHandler {
public: public:
WireServer(const WireServerDescriptor& descriptor); explicit WireServer(const WireServerDescriptor& descriptor);
~WireServer() override; ~WireServer() override;
const volatile char* HandleCommands(const volatile char* commands, const volatile char* HandleCommands(const volatile char* commands,

View File

@ -210,7 +210,7 @@ namespace dawn::native {
// Adapters are owned by mImpl so it is safe to return non RAII pointers to them // Adapters are owned by mImpl so it is safe to return non RAII pointers to them
std::vector<Adapter> adapters; std::vector<Adapter> adapters;
for (const Ref<AdapterBase>& adapter : mImpl->GetAdapters()) { for (const Ref<AdapterBase>& adapter : mImpl->GetAdapters()) {
adapters.push_back({adapter.Get()}); adapters.push_back(Adapter(adapter.Get()));
} }
return adapters; return adapters;
} }