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=-readability/inheritance
filter=-runtime/explicit
filter=-runtime/indentation_namespace

View File

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

View File

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

View File

@ -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;

View File

@ -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,

View File

@ -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,

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
std::vector<Adapter> adapters;
for (const Ref<AdapterBase>& adapter : mImpl->GetAdapters()) {
adapters.push_back({adapter.Get()});
adapters.push_back(Adapter(adapter.Get()));
}
return adapters;
}