[clang-tools-extra] [clang-tidy] Add bugprone-container-bounds-check-overflow check (PR #206349)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 28 10:11:59 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- clang-tools-extra/clang-tidy/bugprone/ContainerBoundsCheckOverflowCheck.cpp clang-tools-extra/clang-tidy/bugprone/ContainerBoundsCheckOverflowCheck.h clang-tools-extra/test/clang-tidy/checkers/bugprone/container-bounds-check-overflow.cpp clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clang-tidy/bugprone/ContainerBoundsCheckOverflowCheck.h b/clang-tools-extra/clang-tidy/bugprone/ContainerBoundsCheckOverflowCheck.h
index 47d454ae7..280986385 100644
--- a/clang-tools-extra/clang-tidy/bugprone/ContainerBoundsCheckOverflowCheck.h
+++ b/clang-tools-extra/clang-tidy/bugprone/ContainerBoundsCheckOverflowCheck.h
@@ -13,8 +13,9 @@
namespace clang::tidy::bugprone {
-/// Check for potential overflow in unsigned integer addition before comparison with a container's size() method.
-/// For example a + b > v.size() can overflow if a and b are large enough, leading to incorrect behavior
+/// Check for potential overflow in unsigned integer addition before comparison
+/// with a container's size() method. For example a + b > v.size() can overflow
+/// if a and b are large enough, leading to incorrect behavior
///
/// For the user-facing documentation see:
/// https://clang.llvm.org/extra/clang-tidy/checks/bugprone/container-bounds-check-overflow.html
``````````
</details>
https://github.com/llvm/llvm-project/pull/206349
More information about the cfe-commits
mailing list