Tweaks from clang-tidy (#92)

This is (perhaps) mainly for discussion as I saw you removed
`clang-tidy` checks last year. These fix a variety of minor things.

With one of the options that I was using, these still remain:

```
/Users/bruce/Development/custodian/cpptrace/src/symbols/../utils/utils.hpp:235:22: warning: noexcept specifier on the move constructor evaluates to 'false' [performance-noexcept-move-constructor]
  235 |             noexcept(std::is_nothrow_move_constructible<T>::value)
      |                      ^
/Users/bruce/Development/custodian/cpptrace/src/symbols/../utils/utils.hpp:250:64: warning: noexcept specifier on the move assignment operator evaluates to 'false' [performance-noexcept-move-constructor]
  250 |             noexcept(std::is_nothrow_move_assignable<T>::value && std::is_nothrow_move_constructible<T>::value)
      |                                                                ^
```
This commit is contained in:
Bruce Mitchener 2024-02-19 00:21:48 +07:00 committed by GitHub
parent 1488460172
commit a144002bf0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 12 deletions

View File

@ -293,7 +293,7 @@ namespace cpptrace {
// Interface for a traced exception object // Interface for a traced exception object
class CPPTRACE_EXPORT exception : public std::exception { class CPPTRACE_EXPORT exception : public std::exception {
public: public:
virtual const char* what() const noexcept = 0; const char* what() const noexcept override = 0;
virtual const char* message() const noexcept = 0; virtual const char* message() const noexcept = 0;
virtual const stacktrace& trace() const noexcept = 0; virtual const stacktrace& trace() const noexcept = 0;
}; };
@ -413,7 +413,7 @@ namespace cpptrace {
mutable std::string message_value; mutable std::string message_value;
public: public:
explicit nested_exception( explicit nested_exception(
std::exception_ptr exception_ptr, const std::exception_ptr& exception_ptr,
raw_trace&& trace = detail::get_raw_trace_and_absorb() raw_trace&& trace = detail::get_raw_trace_and_absorb()
) noexcept ) noexcept
: lazy_exception(std::move(trace)), ptr(exception_ptr) {} : lazy_exception(std::move(trace)), ptr(exception_ptr) {}

View File

@ -372,7 +372,7 @@ namespace detail {
// produce information similar to dsymutil -dump-debug-map // produce information similar to dsymutil -dump-debug-map
static void print_debug_map(const debug_map& debug_map) { static void print_debug_map(const debug_map& debug_map) {
for(const auto& entry : debug_map) { for(const auto& entry : debug_map) {
std::cout<<entry.first<<": "<<std::endl; std::cout<<entry.first<<": "<< '\n';
for(const auto& symbol : entry.second) { for(const auto& symbol : entry.second) {
std::cerr std::cerr
<< " " << " "
@ -383,7 +383,7 @@ namespace detail {
<< " " << " "
<< symbol.size << symbol.size
<< std::dec << std::dec
<< std::endl; << '\n';
} }
} }
} }

View File

@ -174,10 +174,10 @@ namespace cpptrace {
) { ) {
detail::enable_virtual_terminal_processing_if_needed(); detail::enable_virtual_terminal_processing_if_needed();
} }
stream<<(header ? header : "Stack trace (most recent call first):")<<std::endl; stream<<(header ? header : "Stack trace (most recent call first):") << '\n';
std::size_t counter = 0; std::size_t counter = 0;
if(frames.empty()) { if(frames.empty()) {
stream<<"<empty trace>"<<std::endl; stream<<"<empty trace>" << '\n';
return; return;
} }
const auto reset = color ? ESC "0m" : ""; const auto reset = color ? ESC "0m" : "";
@ -237,7 +237,7 @@ namespace cpptrace {
} }
} }
if(newline_at_end || &frame != &frames.back()) { if(newline_at_end || &frame != &frames.back()) {
stream << std::endl; stream << '\n';
} }
counter++; counter++;
} }

View File

@ -186,7 +186,7 @@ namespace libdwarf {
} }
CPPTRACE_FORCE_NO_INLINE_FOR_PROFILING CPPTRACE_FORCE_NO_INLINE_FOR_PROFILING
~dwarf_resolver() { ~dwarf_resolver() override {
// TODO: Maybe redundant since dwarf_finish(dbg); will clean up the line stuff anyway but may as well just // TODO: Maybe redundant since dwarf_finish(dbg); will clean up the line stuff anyway but may as well just
// for thoroughness // for thoroughness
for(auto& entry : line_contexts) { for(auto& entry : line_contexts) {
@ -928,7 +928,7 @@ namespace libdwarf {
optional<std::unordered_map<std::string, uint64_t>> symbols; optional<std::unordered_map<std::string, uint64_t>> symbols;
std::unique_ptr<symbol_resolver> resolver; std::unique_ptr<symbol_resolver> resolver;
target_object(std::string object_path) : object_path(object_path) {} target_object(std::string object_path) : object_path(std::move(object_path)) {}
std::unique_ptr<symbol_resolver>& get_resolver() { std::unique_ptr<symbol_resolver>& get_resolver() {
if(!resolver) { if(!resolver) {
@ -1003,7 +1003,7 @@ namespace libdwarf {
// get symbol entries from debug map, as well as the various object files used to make this binary // get symbol entries from debug map, as well as the various object files used to make this binary
for(auto& entry : source_debug_map) { for(auto& entry : source_debug_map) {
// object it came from // object it came from
target_objects.push_back({std::move(entry.first)}); target_objects.push_back({entry.first});
// push the symbols // push the symbols
auto& map_entry_symbols = entry.second; auto& map_entry_symbols = entry.second;
symbols.reserve(symbols.size() + map_entry_symbols.size()); symbols.reserve(symbols.size() + map_entry_symbols.size());

View File

@ -280,7 +280,7 @@ namespace detail {
return *this; return *this;
} }
void swap(optional& other) { void swap(optional& other) noexcept {
if(holds_value && other.holds_value) { if(holds_value && other.holds_value) {
std::swap(uvalue, other.uvalue); std::swap(uvalue, other.uvalue);
} else if(holds_value && !other.holds_value) { } else if(holds_value && !other.holds_value) {
@ -409,7 +409,7 @@ namespace detail {
optional<D> deleter; optional<D> deleter;
public: public:
raii_wrapper(T obj, D deleter) : obj(obj), deleter(deleter) {} raii_wrapper(T obj, D deleter) : obj(obj), deleter(deleter) {}
raii_wrapper(raii_wrapper&& other) noexcept : obj(std::move(other.obj)), deleter(other.deleter) { raii_wrapper(raii_wrapper&& other) noexcept : obj(std::move(other.obj)), deleter(std::move(other.deleter)) {
other.deleter = nullopt; other.deleter = nullopt;
} }
raii_wrapper(const raii_wrapper&) = delete; raii_wrapper(const raii_wrapper&) = delete;