@@ -84,6 +84,29 @@ SourceLocation findNextTerminator(SourceLocation Start,
const SourceManager ,
return findNextAnyTokenKind(Start, SM, LangOpts, tok::comma, tok::semi);
}
+SourceLocation findNextTokenKind(SourceLocation Start, const SourceManager ,
+
@@ -0,0 +1,34 @@
+.. title:: clang-tidy - modernize-use-uniform-initializer
+
+modernize-use-uniform-initializer
+=
+
+Finds usage of C-Style initialization that can be rewritten with
+C++-11 uniform initializers.
+
+Example
+---
+
+..
@@ -0,0 +1,320 @@
+//===--- UseUniformInitializerCheck.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:
@@ -0,0 +1,320 @@
+//===--- UseUniformInitializerCheck.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:
@@ -0,0 +1,320 @@
+//===--- UseUniformInitializerCheck.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:
@@ -0,0 +1,320 @@
+//===--- UseUniformInitializerCheck.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:
@@ -0,0 +1,320 @@
+//===--- UseUniformInitializerCheck.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:
@@ -0,0 +1,174 @@
+// RUN: %check_clang_tidy -std=c++11 %s modernize-use-uniform-initializer %t
+
+int cinit_0 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: Use uniform initializer instead
of C-style initializer [modernize-use-uniform-initializer]
+// CHECK-FIXES: int
@@ -0,0 +1,320 @@
+//===--- UseUniformInitializerCheck.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:
https://github.com/PiotrZSL commented:
Overall, i would see this as readability check.
And I would see this as configurable check, so I could select one of:
` = 10;`, or `(10);` or `{10};` and stick to that convention.
Other thing, in project not so long ago we had issues with {}
@@ -0,0 +1,320 @@
+//===--- UseUniformInitializerCheck.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:
@@ -0,0 +1,320 @@
+//===--- UseUniformInitializerCheck.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:
@@ -0,0 +1,174 @@
+// RUN: %check_clang_tidy -std=c++11 %s modernize-use-uniform-initializer %t
+
+int cinit_0 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: Use uniform initializer instead
of C-style initializer [modernize-use-uniform-initializer]
+// CHECK-FIXES: int
https://github.com/PiotrZSL edited
https://github.com/llvm/llvm-project/pull/91124
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,320 @@
+//===--- UseUniformInitializerCheck.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:
@@ -0,0 +1,320 @@
+//===--- UseUniformInitializerCheck.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:
@@ -0,0 +1,320 @@
+//===--- UseUniformInitializerCheck.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:
https://github.com/PiotrZSL closed
https://github.com/llvm/llvm-project/pull/91071
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PiotrZSL approved this pull request.
https://github.com/llvm/llvm-project/pull/91071
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PiotrZSL approved this pull request.
LGTM
https://github.com/llvm/llvm-project/pull/90965
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,120 @@
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s modernize-use-std-format %t -- \
+// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \
+// RUN: -- -isystem %clang_tidy_headers
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s
https://github.com/PiotrZSL approved this pull request.
LGTM
https://github.com/llvm/llvm-project/pull/90868
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,120 @@
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s modernize-use-std-format %t -- \
+// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \
+// RUN: -- -isystem %clang_tidy_headers
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s
@@ -0,0 +1,120 @@
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s modernize-use-std-format %t -- \
+// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \
+// RUN: -- -isystem %clang_tidy_headers
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s
https://github.com/PiotrZSL approved this pull request.
LGTM
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,97 @@
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s modernize-use-std-format %t -- \
+// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \
+// RUN: -- -isystem %clang_tidy_headers
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s
https://github.com/PiotrZSL edited
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,26 @@
+.. title:: clang-tidy - readability-mark-static
+
+readability-mark-static
+===
+
+Detects variable and function can be marked as static.
+
+Static functions and variables are scoped to a single file. Marking functions
+and variables as
@@ -0,0 +1,26 @@
+.. title:: clang-tidy - readability-mark-static
+
+readability-mark-static
+===
+
+Detects variable and function can be marked as static.
+
+Static functions and variables are scoped to a single file. Marking functions
+and variables as
PiotrZSL wrote:
> Maybe I can provide an option to treat some extension as main file also.
Clang-tidy already got those options, check just need to utilize them.
https://github.com/llvm/llvm-project/pull/90830
___
cfe-commits mailing list
PiotrZSL wrote:
> Isn't this already covered by `-Wmissing-prototypes`?
No, because -Wmissing-prototypes will not provide warning, when both
declaration and definition is in .cpp
https://github.com/llvm/llvm-project/pull/90830
___
cfe-commits
https://github.com/PiotrZSL requested changes to this pull request.
1. Wrong check name, maybe readability-unessesary-external-linkage or
something, maybe it should even be an performance check [as there it will bring
more benefits] (current check suggest more an "static methods").
2. Add
@@ -0,0 +1,26 @@
+.. title:: clang-tidy - readability-mark-static
+
+readability-mark-static
+===
+
+Detects variable and function can be marked as static.
+
+Static functions and variables are scoped to a single file. Marking functions
+and variables as
@@ -0,0 +1,65 @@
+//===--- MarkStaticCheck.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:
https://github.com/PiotrZSL edited
https://github.com/llvm/llvm-project/pull/90830
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PiotrZSL closed
https://github.com/llvm/llvm-project/pull/90560
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PiotrZSL closed
https://github.com/llvm/llvm-project/pull/90566
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -380,3 +387,20 @@ namespace PR51861 {
// CHECK-FIXES: {{^}}PR51861::Foo::getBar();{{$}}
}
}
+
+namespace PR75163 {
PiotrZSL wrote:
PR = Problem Report (in this context)
https://github.com/llvm/llvm-project/pull/90736
https://github.com/PiotrZSL created
https://github.com/llvm/llvm-project/pull/90736
Improved readability-static-accessed-through-instance check to
support expressions with side-effects.
Originally calls to overloaded operator were
ignored by check, in fear of possible side-effects.
This
https://github.com/PiotrZSL approved this pull request.
https://github.com/llvm/llvm-project/pull/90581
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PiotrZSL edited
https://github.com/llvm/llvm-project/pull/90581
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PiotrZSL approved this pull request.
LGTM
https://github.com/llvm/llvm-project/pull/90581
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PiotrZSL created
https://github.com/llvm/llvm-project/pull/90621
Improved hicpp-signed-bitwise check by ignoring false positives involving
positive integer literals behind implicit casts when
IgnorePositiveIntegerLiterals is enabled.
Closes #89367
>From
https://github.com/PiotrZSL created
https://github.com/llvm/llvm-project/pull/90566
Improved bugprone-casting-through-void check by ignoring casts where source is
already a void pointer, making middle void pointer casts bug-free.
Closes #87069
>From f516abcfbcb0a9bca13a416b73b0d59bb144bbbf
https://github.com/PiotrZSL closed
https://github.com/llvm/llvm-project/pull/90279
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PiotrZSL created
https://github.com/llvm/llvm-project/pull/90560
>From now readability-const-return-type won't provide warnings for returning
>const types, where const is not on top level. In such case const there is a
>performance issue, but not a readability.
Closes
@@ -0,0 +1,72 @@
+set(CMAKE_C_COMPILER "/usr/bin/cc")
PiotrZSL wrote:
Looks like simple mistake, plee remove that build directory from a change.
https://github.com/llvm/llvm-project/pull/89553
___
cfe-commits mailing
https://github.com/PiotrZSL created
https://github.com/llvm/llvm-project/pull/90410
Ignore optionals in unevaluated context, like static_assert or decltype.
Closes #89593
>From 7dcbe220d74f2be4ade8429e6c0e710d7d7c58a4 Mon Sep 17 00:00:00 2001
From: Piotr Zegar
Date: Sun, 28 Apr 2024 19:16:43
https://github.com/PiotrZSL updated
https://github.com/llvm/llvm-project/pull/86448
>From 1b5c351acca7375c577111a4c55506146ef108ef Mon Sep 17 00:00:00 2001
From: Piotr Zegar
Date: Sun, 24 Mar 2024 18:39:54 +
Subject: [PATCH 1/4] [clang-tidy] Added bugprone-exception-rethrow check
@@ -0,0 +1,50 @@
+//===--- ExceptionRethrowCheck.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:
@@ -0,0 +1,50 @@
+//===--- ExceptionRethrowCheck.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:
@@ -0,0 +1,50 @@
+//===--- ExceptionRethrowCheck.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:
@@ -0,0 +1,37 @@
+//===--- ExceptionRethrowCheck.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:
@@ -0,0 +1,50 @@
+//===--- ExceptionRethrowCheck.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:
@@ -0,0 +1,60 @@
+// RUN: %check_clang_tidy %s bugprone-exception-rethrow %t -- -- -fexceptions
+
+struct exception {};
+
+void correct() {
+ try {
+ throw exception();
+ } catch(const exception &) {
+ throw;
+ }
+}
+
+void correct2() {
+ try {
+ throw
@@ -0,0 +1,97 @@
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s modernize-use-std-format %t -- \
+// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \
+// RUN: -- -isystem %clang_tidy_headers
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s
@@ -0,0 +1,48 @@
+//===--- UseStdFormatCheck.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:
@@ -0,0 +1,84 @@
+.. title:: clang-tidy - modernize-use-std-format
+
+modernize-use-std-format
+
+
+Converts calls to ``absl::StrFormat``, or other functions via
+configuration options, to C++20's ``std::format``, or another function
+via a configuration
@@ -627,7 +628,8 @@ void FormatStringConverter::finalizeFormatText() {
// It's clearer to convert printf("Hello\r\n"); to std::print("Hello\r\n")
// than to std::println("Hello\r");
- if (StringRef(StandardFormatString).ends_with("\\n") &&
+ if
@@ -0,0 +1,108 @@
+//===--- UseStdFormatCheck.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:
https://github.com/PiotrZSL edited
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PiotrZSL approved this pull request.
To be honest I'm not sure why it wasn't merged, there were some dependences on
other changes and modernize-use-std-print check, and somehow it fall under
radar.
Overall looks fine. Please fix pointed out nits that pop up.
@@ -0,0 +1,108 @@
+//===--- UseStdFormatCheck.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:
@@ -488,70 +493,72 @@ def main():
# Build up a big regexy filter from all command line arguments.
file_name_re = re.compile("|".join(args.files))
+files = {f for f in files if file_name_re.search(f)}
-return_code = 0
+returncode = 0
try:
-#
https://github.com/PiotrZSL commented:
One issue, looks like only stdout is buffered, and when clang-tidy output:
"26035 warnings generated.
Suppressed 26030 warnings (26030 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use
-system-headers to display
https://github.com/PiotrZSL edited
https://github.com/llvm/llvm-project/pull/89490
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Author: Piotr Zegar
Date: 2024-04-27T18:51:00Z
New Revision: 0336328e970e7e809d52a33a704bb7c05f6e170e
URL:
https://github.com/llvm/llvm-project/commit/0336328e970e7e809d52a33a704bb7c05f6e170e
DIFF:
https://github.com/llvm/llvm-project/commit/0336328e970e7e809d52a33a704bb7c05f6e170e.diff
LOG:
https://github.com/PiotrZSL closed
https://github.com/llvm/llvm-project/pull/89990
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -269,6 +269,10 @@ Changes in existing checks
don't remove parentheses used in ``sizeof`` calls when they have array index
accesses as arguments.
+- Improved :doc:`modernize-use-nullptr
+ ` check to include support for
+ ``C23``, which also has introduced the
https://github.com/PiotrZSL approved this pull request.
LGTM.
https://github.com/llvm/llvm-project/pull/90279
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
PiotrZSL wrote:
If there is redirection, then we could switch all links to new domain.
https://github.com/llvm/llvm-project/pull/90216
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PiotrZSL approved this pull request.
https://github.com/llvm/llvm-project/pull/90216
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PiotrZSL approved this pull request.
https://github.com/llvm/llvm-project/pull/90173
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
PiotrZSL wrote:
I'm more or less fine with this change, but didn't had time to test it yet.
Does it work with python 3.6 ?
https://github.com/llvm/llvm-project/pull/89490
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/PiotrZSL closed
https://github.com/llvm/llvm-project/pull/84481
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,81 @@
+//===--- AvoidBoundsErrorsCheck.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:
@@ -0,0 +1,66 @@
+namespace std {
+ template
+ struct array {
+T operator[](unsigned i) {
+ return T{1};
+}
+T at(unsigned i) {
+ return T{1};
+}
+ };
+
+ template
+ struct unique_ptr {
+T operator[](unsigned i) {
+ return T{1};
+}
+
@@ -57,6 +58,8 @@ namespace cppcoreguidelines {
class CppCoreGuidelinesModule : public ClangTidyModule {
public:
void addCheckFactories(ClangTidyCheckFactories ) override {
+CheckFactories.registerCheck(
+"cppcoreguidelines-avoid-bounds-errors");
@@ -0,0 +1,81 @@
+//===--- AvoidBoundsErrorsCheck.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:
@@ -0,0 +1,20 @@
+.. title:: clang-tidy - cppcoreguidelines-avoid-bounds-errors
+
+cppcoreguidelines-avoid-bounds-errors
+=
+
+This check enforces the `SL.con.3
@@ -0,0 +1,81 @@
+//===--- AvoidBoundsErrorsCheck.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:
@@ -0,0 +1,81 @@
+//===--- AvoidBoundsErrorsCheck.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:
@@ -0,0 +1,81 @@
+//===--- AvoidBoundsErrorsCheck.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:
@@ -0,0 +1,81 @@
+//===--- AvoidBoundsErrorsCheck.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:
@@ -0,0 +1,81 @@
+//===--- AvoidBoundsErrorsCheck.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:
@@ -0,0 +1,20 @@
+.. title:: clang-tidy - cppcoreguidelines-avoid-bounds-errors
+
+cppcoreguidelines-avoid-bounds-errors
+=
+
+This check enforces the `SL.con.3
https://github.com/PiotrZSL edited
https://github.com/llvm/llvm-project/pull/90043
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,32 @@
+//===--- AvoidBoundsErrorsCheck.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:
@@ -0,0 +1,81 @@
+//===--- AvoidBoundsErrorsCheck.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:
https://github.com/PiotrZSL requested changes to this pull request.
Idea is fine, implementation is lacking critical parts.
Please check comments, fix them.
If you will have some questions, just ask.
https://github.com/llvm/llvm-project/pull/90043
___
https://github.com/PiotrZSL approved this pull request.
https://github.com/llvm/llvm-project/pull/89990
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PiotrZSL closed
https://github.com/llvm/llvm-project/pull/85572
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,181 @@
+// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t
+
+enum tags3 {
+ tags3_1,
+ tags3_2,
+ tags3_3,
+};
+
+enum tags4 {
+ tags4_1,
+ tags4_2,
+ tags4_3,
+ tags4_4,
+};
+
+enum tags5 {
+ tags5_1,
+
@@ -142,6 +142,7 @@ Clang-Tidy Checks
:doc:`bugprone-suspicious-stringview-data-usage
`,
:doc:`bugprone-swapped-arguments `, "Yes"
:doc:`bugprone-switch-missing-default-case
`,
+ :doc:`bugprone-tagged-union-member-count
`, "Yes"
PiotrZSL wrote:
@@ -129,6 +129,12 @@ New checks
Replaces certain conditional statements with equivalent calls to
``std::min`` or ``std::max``.
+- New :doc:`bugprone-tagged-union-member-count
+ ` check.
+
+ Warns about suspicious looking tagged unions where the number of enum
+
@@ -129,6 +129,12 @@ New checks
Replaces certain conditional statements with equivalent calls to
``std::min`` or ``std::max``.
+- New :doc:`bugprone-tagged-union-member-count
PiotrZSL wrote:
move to line 119, keep in alphabetical order
@@ -0,0 +1,181 @@
+// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t
+
+enum tags3 {
+ tags3_1,
+ tags3_2,
+ tags3_3,
+};
+
+enum tags4 {
+ tags4_1,
+ tags4_2,
+ tags4_3,
+ tags4_4,
+};
+
+enum tags5 {
+ tags5_1,
+
@@ -0,0 +1,125 @@
+//===--- TaggedUnionMemberCountCheck.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:
@@ -0,0 +1,181 @@
+// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t
+
+enum tags3 {
+ tags3_1,
+ tags3_2,
+ tags3_3,
+};
+
+enum tags4 {
+ tags4_1,
+ tags4_2,
+ tags4_3,
+ tags4_4,
+};
+
+enum tags5 {
+ tags5_1,
+
@@ -0,0 +1,31 @@
+//===--- TaggedUnionMemberCountCheck.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:
201 - 300 of 1965 matches
Mail list logo