Fix clang-tidy 18.1.8 issues (#3800)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Bart Louwers
2025-09-12 14:35:44 +00:00
committed by GitHub
parent 77b4756454
commit ed1f4b3269
77 changed files with 359 additions and 206 deletions

View File

@@ -22,7 +22,7 @@ public:
glType(other.glType) {}
VertexAttributeGL(VertexAttributeGL&& other)
: VertexAttribute(std::move(other)),
glType(other.glType) {}
glType(other.glType) {} // NOLINT(bugprone-use-after-move)
~VertexAttributeGL() override = default;
platform::GLenum getGLType() const { return glType; }

View File

@@ -47,10 +47,12 @@ enum class MapDebugOptions : EnumType {
};
constexpr MapDebugOptions operator|(MapDebugOptions lhs, MapDebugOptions rhs) {
// NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
return MapDebugOptions(mbgl::underlying_type(lhs) | mbgl::underlying_type(rhs));
}
constexpr MapDebugOptions& operator|=(MapDebugOptions& lhs, MapDebugOptions rhs) {
// NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
return (lhs = MapDebugOptions(mbgl::underlying_type(lhs) | mbgl::underlying_type(rhs)));
}
@@ -59,10 +61,12 @@ constexpr bool operator&(MapDebugOptions lhs, MapDebugOptions rhs) {
}
constexpr MapDebugOptions& operator&=(MapDebugOptions& lhs, MapDebugOptions rhs) {
// NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
return (lhs = MapDebugOptions(mbgl::underlying_type(lhs) & mbgl::underlying_type(rhs)));
}
constexpr MapDebugOptions operator~(MapDebugOptions value) {
// NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
return MapDebugOptions(~mbgl::underlying_type(value));
}

View File

@@ -76,7 +76,7 @@ public:
using ShaderClass = shaders::ShaderSource<ShaderID, gfx::Backend::Type::Vulkan>;
for (const auto& attrib : ShaderClass::attributes) {
if (!propertiesAsUniforms.second.count(attrib.id)) {
if (!propertiesAsUniforms.second.contains(attrib.id)) {
shader->initAttribute(attrib);
}
}

View File

@@ -2,7 +2,11 @@
#include <mbgl/util/work_task.hpp>
#include <atomic>
#include <mutex>
#include <tuple>
#include <type_traits>
#include <utility>
namespace mbgl {
@@ -17,7 +21,7 @@ public:
void operator()() override {
// Lock the mutex while processing so that cancel() will block.
std::lock_guard<std::recursive_mutex> lock(mutex);
if (!*canceled) {
if (!canceled->load(std::memory_order_acquire)) {
invoke(std::make_index_sequence<std::tuple_size_v<P>>{});
}
}
@@ -32,7 +36,7 @@ public:
/// do nothing.
void cancel() override {
std::lock_guard<std::recursive_mutex> lock(mutex);
*canceled = true;
canceled->store(true, std::memory_order_release);
}
private:
@@ -51,7 +55,7 @@ private:
template <class Fn, class... Args>
std::shared_ptr<WorkTask> WorkTask::make(Fn&& fn, Args&&... args) {
auto flag = std::make_shared<std::atomic<bool>>();
*flag = false;
flag->store(false, std::memory_order_relaxed);
auto tuple = std::make_tuple(std::forward<Args>(args)...);
return std::make_shared<WorkTaskImpl<std::decay_t<Fn>, decltype(tuple)>>(

View File

@@ -78,7 +78,7 @@ protected:
class UniformDescriptorSet : public DescriptorSet {
public:
UniformDescriptorSet(Context& context_, DescriptorSetType type_);
virtual ~UniformDescriptorSet() = default;
~UniformDescriptorSet() override = default;
void update(const gfx::UniformBufferArray& uniforms,
uint32_t descriptorStartIndex,
@@ -89,7 +89,7 @@ public:
class ImageDescriptorSet : public DescriptorSet {
public:
ImageDescriptorSet(Context& context_);
virtual ~ImageDescriptorSet() = default;
~ImageDescriptorSet() override = default;
void markDirty() override;
const std::chrono::duration<double>& getLastModified() const { return lastModified; }

View File

@@ -102,7 +102,7 @@ class Renderable : public gfx::Renderable {
protected:
Renderable(const Size size_, std::unique_ptr<gfx::RenderableResource> resource_)
: gfx::Renderable(size_, std::move(resource_)) {}
virtual ~Renderable() override = default;
~Renderable() override = default;
public:
void setSize(const Size& size_) { size = size_; }

View File

@@ -54,7 +54,8 @@ public:
int32_t getGraphicsQueueIndex() const { return graphicsQueueIndex; }
int32_t getPresentQueueIndex() const { return presentQueueIndex; }
template <typename T, typename = typename std::enable_if<vk::isVulkanHandleType<T>::value>>
template <typename T>
requires vk::isVulkanHandleType<T>::value
void setDebugName([[maybe_unused]] const T& object, [[maybe_unused]] const std::string& name) const {
#ifdef ENABLE_VULKAN_VALIDATION
if (!debugUtilsEnabled) return;

View File

@@ -40,11 +40,11 @@ public:
UniformBufferArray(UniformBufferArray&& other) noexcept
: gfx::UniformBufferArray(std::move(other)),
descriptorSetType(other.descriptorSetType),
descriptorStartIndex(other.descriptorStartIndex),
descriptorStorageCount(other.descriptorStorageCount),
descriptorUniformCount(other.descriptorUniformCount),
descriptorSet(std::move(other.descriptorSet)) {}
descriptorSetType(other.descriptorSetType), // NOLINT(bugprone-use-after-move)
descriptorStartIndex(other.descriptorStartIndex), // NOLINT(bugprone-use-after-move)
descriptorStorageCount(other.descriptorStorageCount), // NOLINT(bugprone-use-after-move)
descriptorUniformCount(other.descriptorUniformCount), // NOLINT(bugprone-use-after-move)
descriptorSet(std::move(other.descriptorSet)) {} // NOLINT(bugprone-use-after-move)
UniformBufferArray(const UniformBufferArray&) = delete;
@@ -58,7 +58,7 @@ public:
return *this;
}
~UniformBufferArray() = default;
~UniformBufferArray() override = default;
const std::shared_ptr<gfx::UniformBuffer>& set(const size_t id,
std::shared_ptr<gfx::UniformBuffer> uniformBuffer) override;