@@ -0,0 +1,197 @@
+//===--- BoolBitwiseOperationCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -0,0 +1,59 @@
+// RUN: %check_clang_tidy %s misc-bool-bitwise-operation %t \
+// RUN: -config="{CheckOptions: { \
+// RUN: misc-bool-bitwise-operation.IgnoreMacros: true }}"
+
+#define MY_OR |
+#define MY_AND &
+#define MY_OR_ASSIGN |=
+#define MY_AND_ASSIGN &=
+#define M
denzor200 wrote:
> we could add Limitations section in check docs to avoid potential confusion
> and false-negative reports in the future.
Done
https://github.com/llvm/llvm-project/pull/142324
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
h
denzor200 wrote:
> I believe all PiotrZSL's comments are correctly resolved, and we could merge
> it next week if there would be no more reviews. One nit from me: since we
> don't match template functions, we could add `Limitations` section in check
> docs to avoid potential confusion and fals
denzor200 wrote:
ping
https://github.com/llvm/llvm-project/pull/142324
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/denzor200 requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/118120
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,76 @@
+// RUN: %check_clang_tidy -std=c++17 %s modernize-make-direct %t
+
+namespace std {
+template
+struct optional {
+ optional(const T&) {}
+};
+
+template
+optional make_optional(const T& t) { return optional(t); }
+
+template
+struct unique_ptr {
+ explicit uni
@@ -0,0 +1,562 @@
+// RUN: %check_clang_tidy -std=c++11 -check-suffix=11 %s misc-use-constexpr %t
-- -- -fno-delayed-template-parsing
+// RUN: %check_clang_tidy -std=c++14 -check-suffix=11,14 %s misc-use-constexpr
%t -- -- -fno-delayed-template-parsing
+// RUN: %check_clang_tidy
@@ -0,0 +1,562 @@
+// RUN: %check_clang_tidy -std=c++11 -check-suffix=11 %s misc-use-constexpr %t
-- -- -fno-delayed-template-parsing
+// RUN: %check_clang_tidy -std=c++14 -check-suffix=11,14 %s misc-use-constexpr
%t -- -- -fno-delayed-template-parsing
+// RUN: %check_clang_tidy
denzor200 wrote:
`constexpr` is one of the important additions of C++11. Most of the users will
search this check in "modernize" section and will be misled by not finding it
there.
"misc-const-correctness" - not a modernize check at all, it even relevant for
C++98, so it exists in "misc"
htt
denzor200 wrote:
> misc-use-constexpr? :)
modernize-use-constexpr?
https://github.com/llvm/llvm-project/pull/146553
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,437 @@
+// RUN: %check_clang_tidy -std=c++14 %s bugprone-incorrect-iterators %t
+
+namespace std {
+
+template struct pair {};
+
+namespace execution {
+
+class parallel_policy {};
+
+constexpr parallel_policy par;
+
+} // namespace execution
+
+template class reverse
https://github.com/denzor200 requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/99917
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,163 @@
+.. title:: clang-tidy - bugprone-null-check-after-dereference
+
+bugprone-null-check-after-dereference
+=
+
+.. note::
+
+ This check uses a flow-sensitive static analysis to produce its
+ results. Therefore, it may be mor
@@ -0,0 +1,219 @@
+//===--- BoolBitwiseOperationCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
denzor200 wrote:
@HerrCai0907 @PiotrZSL could you please approve again?
https://github.com/llvm/llvm-project/pull/142324
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -36,6 +37,8 @@ class PerformanceModule : public ClangTidyModule {
public:
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
CheckFactories.registerCheck("performance-avoid-endl");
+CheckFactories.registerCheck(
+"performance-bool-bi
https://github.com/denzor200 edited
https://github.com/llvm/llvm-project/pull/142324
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/denzor200 edited
https://github.com/llvm/llvm-project/pull/142324
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,208 @@
+//===--- BoolBitwiseOperationCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -0,0 +1,403 @@
+// RUN: %check_clang_tidy %s performance-bool-bitwise-operation %t
+
+bool& normal() {
+int a = 100, b = 200;
+
+a | b;
+a & b;
+a |= b;
+a &= b;
+
+static bool st = false;
+return st;
+}
+
+bool bad() noexcept __attribute__((pure)) {
@@ -0,0 +1,208 @@
+//===--- BoolBitwiseOperationCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -0,0 +1,208 @@
+//===--- BoolBitwiseOperationCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -0,0 +1,208 @@
+//===--- BoolBitwiseOperationCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -0,0 +1,208 @@
+//===--- BoolBitwiseOperationCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -0,0 +1,208 @@
+//===--- BoolBitwiseOperationCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -0,0 +1,208 @@
+//===--- BoolBitwiseOperationCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
denzor200 wrote:
ping
https://github.com/llvm/llvm-project/pull/142324
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
denzor200 wrote:
> Did you have a chance to run the test on a large codebase (e.g. the
> llvm-project) and see if we get any FPs in this regard?
Here is the full result:
[1.log](https://github.com/user-attachments/files/20644432/1.log)
At the first sight no FP at all
https://github.com/llvm/l
denzor200 wrote:
> Ok, that's great! Did you have a chance to run the test on a large codebase
> (e.g. the llvm-project) and see if we get any FPs in this regard?
Going to do it
https://github.com/llvm/llvm-project/pull/142324
___
cfe-commits mailing
denzor200 wrote:
> Actually, another reason for not putting this in performance is that the
> changes made by this check may lead to non-functional changes in the code. If
> the RHS operand is a function that has side effects, this check will change
> the logic of the code, since the RHS may n
denzor200 wrote:
> Personally I don't think this is a `performance` check. Boolean operators are
> for bools; bitwise operators are for ints. I would put this in `readability`
> or `misc` instead.
I've put this in the performance section because evaluating only one
operand(which will be in mo
@@ -0,0 +1,108 @@
+#include "MakeFunctionToDirectCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/Type.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
+#include "clang/Lex/Lexer.h"
+
+using namespace clang::ast_matchers
@@ -0,0 +1,20 @@
+#include "../ClangTidyCheck.h"
+
+namespace clang::tidy::modernize {
+
+class MakeFunctionToDirectCheck : public ClangTidyCheck {
denzor200 wrote:
It can be refactored with `TransformerClangTidyCheck` usage. Sample for only
`std::make_pair` fun
https://github.com/denzor200 requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/118120
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,17 @@
+.. title:: clang-tidy - modernize-make-direct
+
+modernize-make-direct
+
+
+Replaces ``std::make_*`` function calls with direct constructor calls using
class template
+argument deduction (CTAD).
+
+== =
@@ -64,16 +64,21 @@ AST_MATCHER(CXXRecordDecl, correctHandleCaptureThisLambda) {
constexpr const char *DefaultFunctionWrapperTypes =
"::std::function;::std::move_only_function;::boost::function";
+constexpr const char *DefaultBindFunctions = "::std::bind;::boost::bind";
--
denzor200 wrote:
LGTM, please provide the change for one comment I left
https://github.com/llvm/llvm-project/pull/130297
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,36 @@
+.. title:: clang-tidy - bugprone-capturing-this-in-member-variable
+
+bugprone-capturing-this-in-member-variable
+==
+
+Finds lambda captures that capture the ``this`` pointer and store it as class
+members without handle t
@@ -0,0 +1,36 @@
+.. title:: clang-tidy - bugprone-capturing-this-in-member-variable
+
+bugprone-capturing-this-in-member-variable
+==
+
+Finds lambda captures that capture the ``this`` pointer and store it as class
+members without handle t
https://github.com/denzor200 approved this pull request.
https://github.com/llvm/llvm-project/pull/130297
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,144 @@
+// RUN: %check_clang_tidy -std=c++11-or-later %s
bugprone-capturing-this-by-field %t -- -config="{CheckOptions:
{bugprone-capturing-this-by-field.FunctionWrapperTypes:
'::std::function;::Fn'}}" --
denzor200 wrote:
Created issues about bind a
https://github.com/denzor200 edited
https://github.com/llvm/llvm-project/pull/130297
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,44 @@
+//===--- CapturingThisByFieldCheck.h - clang-tidy ---*- C++
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
@@ -0,0 +1,144 @@
+// RUN: %check_clang_tidy -std=c++11-or-later %s
bugprone-capturing-this-by-field %t -- -config="{CheckOptions:
{bugprone-capturing-this-by-field.FunctionWrapperTypes:
'::std::function;::Fn'}}" --
denzor200 wrote:
Oke, don't worry about bind
@@ -0,0 +1,44 @@
+//===--- CapturingThisByFieldCheck.h - clang-tidy ---*- C++
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
https://github.com/denzor200 edited
https://github.com/llvm/llvm-project/pull/130297
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,144 @@
+// RUN: %check_clang_tidy -std=c++11-or-later %s
bugprone-capturing-this-by-field %t -- -config="{CheckOptions:
{bugprone-capturing-this-by-field.FunctionWrapperTypes:
'::std::function;::Fn'}}" --
+
+namespace std {
+
+template
+class function;
+
+template
+c
@@ -0,0 +1,144 @@
+// RUN: %check_clang_tidy -std=c++11-or-later %s
bugprone-capturing-this-by-field %t -- -config="{CheckOptions:
{bugprone-capturing-this-by-field.FunctionWrapperTypes:
'::std::function;::Fn'}}" --
+
+namespace std {
+
+template
+class function;
+
+template
+c
https://github.com/denzor200 requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/130297
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -118,6 +119,8 @@ class BugproneModule : public ClangTidyModule {
CheckFactories.registerCheck(
"bugprone-bool-pointer-implicit-conversion");
CheckFactories.registerCheck("bugprone-branch-clone");
+CheckFactories.registerCheck(
+"bugprone-capture-t
@@ -0,0 +1,99 @@
+//===--- CaptureThisByFieldCheck.cpp - clang-tidy
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
https://github.com/denzor200 approved this pull request.
https://github.com/llvm/llvm-project/pull/121291
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,130 @@
+//===--- AmbiguousSmartptrResetCallCheck.cpp - clang-tidy
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
https://github.com/denzor200 requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/121291
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,130 @@
+//===--- AmbiguousSmartptrResetCallCheck.cpp - clang-tidy
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -0,0 +1,131 @@
+//===--- AmbiguousSmartptrResetCallCheck.cpp - clang-tidy
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
https://github.com/denzor200 requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/121291
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,48 @@
+.. title:: clang-tidy - readability-ambiguous-smartptr-reset-call
+
+readability-ambiguous-smartptr-reset-call
+=
+
+Finds potentially erroneous calls to ``reset`` method on smart pointers when
+the pointee type also has a
denzor200 wrote:
> Wouldn't that be a runtime check, and thus not something clang-tidy can do
> without significant data flow analysis effort?
I'm not experienced enough in clang-tidy internals, but I believe it will not
be a serious challenge to check for having `assert(sp.use_count() == 1)`
@@ -0,0 +1,34 @@
+//===--- SmartptrResetAmbiguousCallCheck.h - clang-tidy -*- C++
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
denzor200 wrote:
Suppose this check should be silent for a shared_ptr with `use_count() == 1`.
Is it possible to change implementation in order to following this way?
https://github.com/llvm/llvm-project/pull/67467
___
cfe-commits mailing list
cfe-com
@@ -0,0 +1,149 @@
+// RUN: %check_clang_tidy -std=c++20 %s readability-use-span-first-last %t
+
+namespace std {
+template
+class span {
+ T* ptr;
+ __SIZE_TYPE__ len;
+
+public:
+ span(T* p, __SIZE_TYPE__ l) : ptr(p), len(l) {}
+
+ span subspan(__SIZE_TYPE__ offset) const
@@ -0,0 +1,108 @@
+// RUN: %check_clang_tidy %s readability-stringview-substr %t
+
+namespace std {
+template
+class basic_string_view {
+public:
+ using size_type = unsigned long;
+ static constexpr size_type npos = -1;
+
+ basic_string_view(const char*) {}
+ basic_string_vi
@@ -0,0 +1,108 @@
+// RUN: %check_clang_tidy %s readability-stringview-substr %t
+
+namespace std {
+template
+class basic_string_view {
+public:
+ using size_type = unsigned long;
+ static constexpr size_type npos = -1;
+
+ basic_string_view(const char*) {}
+ basic_string_vi
@@ -0,0 +1,103 @@
+// RUN: %check_clang_tidy %s bugprone-exception-rethrow %t -- -- -fexceptions
+
+struct exception {};
+
+namespace std {
+ template
+ T&& move(T &&x) {
+return static_cast(x);
+ }
+}
+
+void correct() {
+ try {
+ throw exception();
+ } catch(const
66 matches
Mail list logo