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>
diff --git a/include/dawn/CPPLINT.cfg b/include/dawn/CPPLINT.cfg
index cab84f8..c2e9bca 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 e5272f3..7bfe4ec 100644
--- a/include/dawn/EnumClassBitmasks.h
+++ b/include/dawn/EnumClassBitmasks.h
@@ -54,6 +54,7 @@
struct BoolConvertible {
using Integral = typename std::underlying_type<T>::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 599921b..99a6c62 100644
--- a/include/dawn/native/D3D12Backend.h
+++ b/include/dawn/native/D3D12Backend.h
@@ -101,7 +101,7 @@
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;
};
diff --git a/include/dawn/native/DawnNative.h b/include/dawn/native/DawnNative.h
index d6ccaca..dc54ded 100644
--- a/include/dawn/native/DawnNative.h
+++ b/include/dawn/native/DawnNative.h
@@ -69,6 +69,7 @@
class DAWN_NATIVE_EXPORT Adapter {
public:
Adapter();
+ // NOLINTNEXTLINE(runtime/explicit)
Adapter(AdapterBase* impl);
~Adapter();
@@ -124,7 +125,7 @@
const WGPUBackendType backendType;
protected:
- AdapterDiscoveryOptionsBase(WGPUBackendType type);
+ explicit AdapterDiscoveryOptionsBase(WGPUBackendType type);
};
enum BackendValidationLevel { Full, Partial, Disabled };
@@ -222,7 +223,7 @@
ExternalImageType GetType() const;
protected:
- ExternalImageDescriptor(ExternalImageType type);
+ explicit ExternalImageDescriptor(ExternalImageType type);
private:
ExternalImageType mType;
@@ -240,7 +241,7 @@
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 ddda1d3..7771188 100644
--- a/include/dawn/wire/WireClient.h
+++ b/include/dawn/wire/WireClient.h
@@ -65,7 +65,7 @@
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 2e37446..7c8fb56 100644
--- a/include/dawn/wire/WireServer.h
+++ b/include/dawn/wire/WireServer.h
@@ -36,7 +36,7 @@
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 6a139a5..1785c6d 100644
--- a/src/dawn/native/DawnNative.cpp
+++ b/src/dawn/native/DawnNative.cpp
@@ -210,7 +210,7 @@
// 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;
}