From 91b56fd2e61209f7996fffc17a2fe5d3ccd87c80 Mon Sep 17 00:00:00 2001 From: Radu Benea Date: Tue, 20 Aug 2024 10:57:52 +0300 Subject: [PATCH] clang-tidy: modernize --- .clang-tidy | 2 +- source/cppfront.cpp | 2 +- source/io.h | 3 +-- source/parse.h | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index f0cc73c23..ab41236f3 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1 +1 @@ -Checks: 'misc-*, -misc-definitions-in-headers, -misc-non-private-member-variables-in-classes, -misc-no-recursion, -misc-include-cleaner, -misc-use-anonymous-namespace' +Checks: 'modernize-*, misc-*, -misc-definitions-in-headers, -misc-non-private-member-variables-in-classes, -misc-no-recursion, -misc-include-cleaner, -misc-use-anonymous-namespace, -modernize-use-trailing-return-type, -modernize-use-nodiscard, -modernize-use-emplace, -modernize-loop-convert, -modernize-pass-by-value, -modernize-use-equals-delete, -modernize-use-equals-default, -modernize-use-override, -modernize-avoid-c-arrays, -modernize-raw-string-literal, -modernize-concat-nested-namespaces' diff --git a/source/cppfront.cpp b/source/cppfront.cpp index a5dbb00ca..a74264a0a 100644 --- a/source/cppfront.cpp +++ b/source/cppfront.cpp @@ -137,7 +137,7 @@ auto main( auto total_time = print_with_thousands(t.elapsed().count()); std::cout << "\n Time " << total_time << " ms"; - std::multimap< long long, std::string_view, std::greater > sorted_timers; + std::multimap< long long, std::string_view, std::greater<> > sorted_timers; for (auto [name, t] : timers) { sorted_timers.insert({t.elapsed().count(), name}); } diff --git a/source/io.h b/source/io.h index d7b71e187..c320ff337 100644 --- a/source/io.h +++ b/source/io.h @@ -841,7 +841,7 @@ class source static const int max_line_len = 90'000; // do not reduce this - I encountered an 80,556-char // line in real world code during testing - char buf[max_line_len]; + char buf[max_line_len] {0}; public: //----------------------------------------------------------------------- @@ -854,7 +854,6 @@ class source ) : errors{ errors_ } , lines( 1 ) // extra blank to avoid off-by-one everywhere - , buf{0} { } diff --git a/source/parse.h b/source/parse.h index 1ca2c3a49..6249f95a5 100644 --- a/source/parse.h +++ b/source/parse.h @@ -3325,7 +3325,7 @@ struct declaration_node { // Convert the gather_ results to const* auto tmp = gather_type_scope_declarations(w); - return std::vector(tmp.begin(), tmp.end()); + return {tmp.begin(), tmp.end()}; }