From 6f453b8f50d45cfa2977cab0eed4254c3da3287b Mon Sep 17 00:00:00 2001 From: firewave Date: Thu, 9 Oct 2025 18:17:02 +0200 Subject: [PATCH] enabled and fixed `performance-noexcept-move-constructor` clang-tidy warnings --- .clang-tidy | 3 +-- simplecpp.cpp | 4 ++-- simplecpp.h | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 182f1a55..8930fa80 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -47,8 +47,7 @@ Checks: > -readability-uppercase-literal-suffix, -performance-avoid-endl, -performance-inefficient-string-concatenation, - -performance-no-automatic-move, - -performance-noexcept-move-constructor + -performance-no-automatic-move HeaderFilterRegex: '.*' WarningsAsErrors: '*' CheckOptions: diff --git a/simplecpp.cpp b/simplecpp.cpp index 7774fd29..34138ce6 100644 --- a/simplecpp.cpp +++ b/simplecpp.cpp @@ -499,7 +499,7 @@ simplecpp::TokenList::TokenList(const TokenList &other) : frontToken(nullptr), b *this = other; } -simplecpp::TokenList::TokenList(TokenList &&other) : frontToken(nullptr), backToken(nullptr), files(other.files) +simplecpp::TokenList::TokenList(TokenList &&other) noexcept : frontToken(nullptr), backToken(nullptr), files(other.files) { *this = std::move(other); } @@ -521,7 +521,7 @@ simplecpp::TokenList &simplecpp::TokenList::operator=(const TokenList &other) return *this; } -simplecpp::TokenList &simplecpp::TokenList::operator=(TokenList &&other) +simplecpp::TokenList &simplecpp::TokenList::operator=(TokenList &&other) noexcept { if (this != &other) { clear(); diff --git a/simplecpp.h b/simplecpp.h index 7e556657..1e50c93c 100644 --- a/simplecpp.h +++ b/simplecpp.h @@ -271,10 +271,10 @@ namespace simplecpp { /** generates a token list from the given filename parameter */ TokenList(const std::string &filename, std::vector &filenames, OutputList *outputList = nullptr); TokenList(const TokenList &other); - TokenList(TokenList &&other); + TokenList(TokenList &&other) noexcept; ~TokenList(); TokenList &operator=(const TokenList &other); - TokenList &operator=(TokenList &&other); + TokenList &operator=(TokenList &&other) noexcept; void clear(); bool empty() const {