Yet more compliance with .clang_tidy, stragglers edition. (flutter/engine#48291)

Based off the
[failures](https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8763786250936903249/+/u/test:_test:_lint_host_debug/stdout)
in https://github.com/flutter/engine/pull/48145.

Nothing particularly interesting.
This commit is contained in:
Matan Lurey
2023-11-21 13:39:18 -08:00
committed by GitHub
parent 4dacd0341d
commit 0b7f44c8c4
13 changed files with 50 additions and 24 deletions

View File

@@ -105,7 +105,7 @@ class MockRenderPass : public RenderPass {
class MockCommandBuffer : public CommandBuffer {
public:
explicit MockCommandBuffer(std::weak_ptr<const Context> context)
: CommandBuffer(context) {}
: CommandBuffer(std::move(context)) {}
MOCK_METHOD(bool, IsValid, (), (const, override));
MOCK_METHOD(void, SetLabel, (const std::string& label), (const, override));
MOCK_METHOD(std::shared_ptr<BlitPass>, OnCreateBlitPass, (), (override));

View File

@@ -21,7 +21,9 @@ G_BEGIN_DECLS
*/
typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_ENGINE_ERROR_FAILED,
// NOLINTEND(readability-identifier-naming)
} FlEngineError;
GQuark fl_engine_error_quark(void) G_GNUC_CONST;

View File

@@ -20,7 +20,9 @@ G_BEGIN_DECLS
*/
typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_RENDERER_ERROR_FAILED,
// NOLINTEND(readability-identifier-naming)
} FlRendererError;
GQuark fl_renderer_error_quark(void) G_GNUC_CONST;

View File

@@ -19,8 +19,10 @@ G_DECLARE_INTERFACE(FlSettings, fl_settings, FL, SETTINGS, GObject)
* Available clock formats.
*/
typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_CLOCK_FORMAT_12H,
FL_CLOCK_FORMAT_24H,
// NOLINTEND(readability-identifier-naming)
} FlClockFormat;
/**
@@ -31,8 +33,10 @@ typedef enum {
* Available color schemes.
*/
typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_COLOR_SCHEME_LIGHT,
FL_COLOR_SCHEME_DARK,
// NOLINTEND(readability-identifier-naming)
} FlColorScheme;
/**

View File

@@ -27,9 +27,11 @@ G_BEGIN_DECLS
#define FL_JSON_MESSAGE_CODEC_ERROR fl_json_message_codec_error_quark()
typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_JSON_MESSAGE_CODEC_ERROR_INVALID_UTF8,
FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON,
FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE,
// NOLINTEND(readability-identifier-naming)
} FlJsonMessageCodecError;
GQuark fl_json_message_codec_error_quark(void) G_GNUC_CONST;

View File

@@ -30,10 +30,12 @@ G_BEGIN_DECLS
#define FL_MESSAGE_CODEC_ERROR fl_message_codec_error_quark()
typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_MESSAGE_CODEC_ERROR_FAILED,
FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA,
FL_MESSAGE_CODEC_ERROR_ADDITIONAL_DATA,
FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE,
// NOLINTEND(readability-identifier-naming)
} FlMessageCodecError;
GQuark fl_message_codec_error_quark(void) G_GNUC_CONST;

View File

@@ -30,9 +30,11 @@ G_BEGIN_DECLS
#define FL_METHOD_RESPONSE_ERROR fl_method_response_error_quark()
typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_METHOD_RESPONSE_ERROR_FAILED,
FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR,
FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED,
// NOLINTEND(readability-identifier-naming)
} FlMethodResponseError;
GQuark fl_method_response_error_quark(void) G_GNUC_CONST;

View File

@@ -40,26 +40,26 @@ MockBinaryMessenger::operator FlBinaryMessenger*() {
}
bool MockBinaryMessenger::HasMessageHandler(const gchar* channel) const {
return message_handlers.at(channel) != nullptr;
return message_handlers_.at(channel) != nullptr;
}
void MockBinaryMessenger::SetMessageHandler(
const gchar* channel,
FlBinaryMessengerMessageHandler handler,
gpointer user_data) {
message_handlers[channel] = handler;
user_datas[channel] = user_data;
message_handlers_[channel] = handler;
user_datas_[channel] = user_data;
}
void MockBinaryMessenger::ReceiveMessage(const gchar* channel,
GBytes* message) {
FlBinaryMessengerMessageHandler handler = message_handlers[channel];
if (response_handles[channel] == nullptr) {
response_handles[channel] = FL_BINARY_MESSENGER_RESPONSE_HANDLE(
FlBinaryMessengerMessageHandler handler = message_handlers_[channel];
if (response_handles_[channel] == nullptr) {
response_handles_[channel] = FL_BINARY_MESSENGER_RESPONSE_HANDLE(
fl_mock_binary_messenger_response_handle_new());
}
handler(instance_, channel, message, response_handles[channel],
user_datas[channel]);
handler(instance_, channel, message, response_handles_[channel],
user_datas_[channel]);
}
static void fl_mock_binary_messenger_iface_init(

View File

@@ -20,6 +20,10 @@ class MockBinaryMessenger {
MockBinaryMessenger();
~MockBinaryMessenger();
// This was an existing use of operator overloading. It's against our style
// guide but enabling clang tidy on header files is a higher priority than
// fixing this.
// NOLINTNEXTLINE(google-explicit-constructor)
operator FlBinaryMessenger*();
MOCK_METHOD(void,
@@ -75,10 +79,10 @@ class MockBinaryMessenger {
private:
FlBinaryMessenger* instance_ = nullptr;
std::unordered_map<std::string, FlBinaryMessengerMessageHandler>
message_handlers;
message_handlers_;
std::unordered_map<std::string, FlBinaryMessengerResponseHandle*>
response_handles;
std::unordered_map<std::string, gpointer> user_datas;
response_handles_;
std::unordered_map<std::string, gpointer> user_datas_;
};
} // namespace testing

View File

@@ -16,6 +16,10 @@ class MockIMContext {
public:
~MockIMContext();
// This was an existing use of operator overloading. It's against our style
// guide but enabling clang tidy on header files is a higher priority than
// fixing this.
// NOLINTNEXTLINE(google-explicit-constructor)
operator GtkIMContext*();
MOCK_METHOD(void,

View File

@@ -18,6 +18,10 @@ class MockSettings {
MockSettings();
~MockSettings();
// This was an existing use of operator overloading. It's against our style
// guide but enabling clang tidy on header files is a higher priority than
// fixing this.
// NOLINTNEXTLINE(google-explicit-constructor)
operator FlSettings*();
MOCK_METHOD(FlClockFormat,

View File

@@ -20,13 +20,13 @@ VulkanApplication::VulkanApplication(
uint32_t application_version,
uint32_t api_version,
bool enable_validation_layers)
: vk(p_vk),
: vk_(p_vk),
api_version_(api_version),
valid_(false),
enable_validation_layers_(enable_validation_layers) {
// Check if we want to enable debugging.
std::vector<VkExtensionProperties> supported_extensions =
GetSupportedInstanceExtensions(vk);
GetSupportedInstanceExtensions(vk_);
bool enable_instance_debugging =
enable_validation_layers_ &&
ExtensionSupported(supported_extensions,
@@ -59,7 +59,7 @@ VulkanApplication::VulkanApplication(
// Configure layers.
const std::vector<std::string> enabled_layers =
InstanceLayersToEnable(vk, enable_validation_layers_);
InstanceLayersToEnable(vk_, enable_validation_layers_);
const char* layers[enabled_layers.size()];
@@ -94,14 +94,14 @@ VulkanApplication::VulkanApplication(
VkInstance instance = VK_NULL_HANDLE;
if (VK_CALL_LOG_ERROR(vk.CreateInstance(&create_info, nullptr, &instance)) !=
if (VK_CALL_LOG_ERROR(vk_.CreateInstance(&create_info, nullptr, &instance)) !=
VK_SUCCESS) {
FML_DLOG(INFO) << "Could not create application instance.";
return;
}
// Now that we have an instance, set up instance proc table entries.
if (!vk.SetupInstanceProcAddresses(VulkanHandle<VkInstance>(instance))) {
if (!vk_.SetupInstanceProcAddresses(VulkanHandle<VkInstance>(instance))) {
FML_DLOG(INFO) << "Could not set up instance proc addresses.";
return;
}
@@ -109,11 +109,11 @@ VulkanApplication::VulkanApplication(
instance_ = VulkanHandle<VkInstance>{instance, [this](VkInstance i) {
FML_DLOG(INFO)
<< "Destroying Vulkan instance";
vk.DestroyInstance(i, nullptr);
vk_.DestroyInstance(i, nullptr);
}};
if (enable_instance_debugging) {
auto debug_report = std::make_unique<VulkanDebugReport>(vk, instance_);
auto debug_report = std::make_unique<VulkanDebugReport>(vk_, instance_);
if (!debug_report->IsValid()) {
FML_DLOG(INFO) << "Vulkan debugging was enabled but could not be set up "
"for this instance.";
@@ -150,8 +150,8 @@ std::vector<VkPhysicalDevice> VulkanApplication::GetPhysicalDevices() const {
}
uint32_t device_count = 0;
if (VK_CALL_LOG_ERROR(vk.EnumeratePhysicalDevices(instance_, &device_count,
nullptr)) != VK_SUCCESS) {
if (VK_CALL_LOG_ERROR(vk_.EnumeratePhysicalDevices(instance_, &device_count,
nullptr)) != VK_SUCCESS) {
FML_DLOG(INFO) << "Could not enumerate physical device.";
return {};
}
@@ -166,7 +166,7 @@ std::vector<VkPhysicalDevice> VulkanApplication::GetPhysicalDevices() const {
physical_devices.resize(device_count);
if (VK_CALL_LOG_ERROR(vk.EnumeratePhysicalDevices(
if (VK_CALL_LOG_ERROR(vk_.EnumeratePhysicalDevices(
instance_, &device_count, physical_devices.data())) != VK_SUCCESS) {
FML_DLOG(INFO) << "Could not enumerate physical device.";
return {};
@@ -179,7 +179,7 @@ std::unique_ptr<VulkanDevice>
VulkanApplication::AcquireFirstCompatibleLogicalDevice() const {
for (auto device_handle : GetPhysicalDevices()) {
auto logical_device = std::make_unique<VulkanDevice>(
vk, VulkanHandle<VkPhysicalDevice>(device_handle),
vk_, VulkanHandle<VkPhysicalDevice>(device_handle),
enable_validation_layers_);
if (logical_device->IsValid()) {
return logical_device;

View File

@@ -44,7 +44,7 @@ class VulkanApplication {
std::unique_ptr<VulkanDevice> AcquireFirstCompatibleLogicalDevice() const;
private:
VulkanProcTable& vk;
VulkanProcTable& vk_;
VulkanHandle<VkInstance> instance_;
uint32_t api_version_;
std::unique_ptr<VulkanDebugReport> debug_report_;