From 2ac9fbc1bf4e7370e754ab44e55e9de741c828be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Sun, 16 Oct 2022 13:51:17 +0200 Subject: [PATCH] include all (internal non-generated) headers in clang-tidy checks (#4100) --- .clang-tidy | 1 + lib/analyzer.h | 1 + lib/programmemory.h | 2 ++ lib/smallvector.h | 2 ++ lib/token.h | 2 +- lib/valueptr.h | 2 ++ test/redirect.h | 2 ++ 7 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index 748a947ee..ff8638db6 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,6 +1,7 @@ --- Checks: '*,-abseil-*,-altera-*,-android-*,-boost-*,-cert-*,-cppcoreguidelines-*,-darwin-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,google-explicit-constructor,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-readability-const-return-type,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-misc-non-private-member-variables-in-classes,-clang-analyzer-*,-bugprone-signed-char-misuse,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument,-readability-identifier-length,-readability-container-data-pointer,-bugprone-assignment-in-if-condition,-misc-const-correctness,-portability-std-allocator-const,-modernize-deprecated-ios-base-aliases,-bugprone-unchecked-optional-access,-modernize-replace-auto-ptr,-readability-identifier-naming,-portability-simd-intrinsics' WarningsAsErrors: '*' +HeaderFilterRegex: '(cli|gui|lib|oss-fuzz|test|triage)\/[a-z]+\.h' CheckOptions: - key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic value: '1' \ No newline at end of file diff --git a/lib/analyzer.h b/lib/analyzer.h index 09fa98165..0476c3ccd 100644 --- a/lib/analyzer.h +++ b/lib/analyzer.h @@ -37,6 +37,7 @@ struct Analyzer { template ), REQUIRES("T must not be a bool", !std::is_same )> + // NOLINTNEXTLINE(google-explicit-constructor) Action(T f) : mFlag(f) // cppcheck-suppress noExplicitConstructor {} diff --git a/lib/programmemory.h b/lib/programmemory.h index 4cf37d8fc..9e763988c 100644 --- a/lib/programmemory.h +++ b/lib/programmemory.h @@ -40,9 +40,11 @@ struct ExprIdToken { ExprIdToken() = default; // cppcheck-suppress noExplicitConstructor + // NOLINTNEXTLINE(google-explicit-constructor) ExprIdToken(const Token* tok) : tok(tok) {} // TODO: Make this constructor only available from ProgramMemory // cppcheck-suppress noExplicitConstructor + // NOLINTNEXTLINE(google-explicit-constructor) ExprIdToken(nonneg int exprid) : exprid(exprid) {} nonneg int getExpressionId() const; diff --git a/lib/smallvector.h b/lib/smallvector.h index ae3dad264..1b537cb1f 100644 --- a/lib/smallvector.h +++ b/lib/smallvector.h @@ -37,6 +37,7 @@ struct TaggedAllocator : std::allocator { template // cppcheck-suppress noExplicitConstructor + // NOLINTNEXTLINE(google-explicit-constructor) TaggedAllocator(Ts&&... ts) : std::allocator(std::forward(ts)...) {} @@ -47,6 +48,7 @@ class SmallVector : public std::vector> { public: template + // NOLINTNEXTLINE(google-explicit-constructor) SmallVector(Ts&&... ts) : std::vector>(std::forward(ts)...) { diff --git a/lib/token.h b/lib/token.h index 974d10c9a..f3a470edb 100644 --- a/lib/token.h +++ b/lib/token.h @@ -1216,7 +1216,7 @@ public: void removeValues(std::function pred) { if (mImpl->mValues) - mImpl->mValues->remove_if(pred); + mImpl->mValues->remove_if(std::move(pred)); } nonneg int index() const { diff --git a/lib/valueptr.h b/lib/valueptr.h index 7d65f976d..8e302a785 100644 --- a/lib/valueptr.h +++ b/lib/valueptr.h @@ -42,6 +42,7 @@ public: template // cppcheck-suppress noExplicitConstructor + // NOLINTNEXTLINE(google-explicit-constructor) ValuePtr(const U& value) : mPtr(cloner::apply(&value)), mClone(&cloner::apply) {} @@ -91,6 +92,7 @@ public: return *this; } + // NOLINTNEXTLINE(google-explicit-constructor) operator bool() const NOEXCEPT { return !!mPtr; } diff --git a/test/redirect.h b/test/redirect.h index 097e2de0a..1a36c2bb5 100644 --- a/test/redirect.h +++ b/test/redirect.h @@ -21,7 +21,9 @@ #include #include +// NOLINTNEXTLINE(readability-redundant-declaration) - TODO: fix this extern std::ostringstream errout; +// NOLINTNEXTLINE(readability-redundant-declaration) - TODO: fix this extern std::ostringstream output; /** * @brief Utility class for capturing cout and cerr to ostringstream buffers