https://github.com/PBHDK updated https://github.com/llvm/llvm-project/pull/95220
From 37292995de0c5aa87408586749795a97468d4725 Mon Sep 17 00:00:00 2001
From: Sebastian Wolf
Date: Wed, 17 Apr 2024 16:16:35 +0200
Subject: [PATCH 01/23] Enforce SL.con.3: Add check to replace operator[] with
at() o
https://github.com/PBHDK updated https://github.com/llvm/llvm-project/pull/95220
From 37292995de0c5aa87408586749795a97468d4725 Mon Sep 17 00:00:00 2001
From: Sebastian Wolf
Date: Wed, 17 Apr 2024 16:16:35 +0200
Subject: [PATCH 01/24] Enforce SL.con.3: Add check to replace operator[] with
at() o
https://github.com/PBHDK updated https://github.com/llvm/llvm-project/pull/95220
From 37292995de0c5aa87408586749795a97468d4725 Mon Sep 17 00:00:00 2001
From: Sebastian Wolf
Date: Wed, 17 Apr 2024 16:16:35 +0200
Subject: [PATCH 01/25] Enforce SL.con.3: Add check to replace operator[] with
at() o
@@ -0,0 +1,124 @@
+//===--- ProBoundsAvoidUncheckedContainerAccesses.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,124 @@
+//===--- ProBoundsAvoidUncheckedContainerAccesses.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
PBHDK wrote:
> > > I am adding @leunam99 and @PBHDK to the PR, who will contribute in the
> > > next few weeks.
> >
> >
> > Since we cannot push to this PR, we will be submitting a new PR with
> > @sebwolf-de's + our work, correct, @EugeneZelenko, @PiotrZSL, @HerrCai0907?
>
> Could you pleas
PBHDK wrote:
> Check if you can commit to sebwolf-de:avoid-bounds-error-check
Unfortunately, we can't. We do not have access to Sebastian's LLVM fork.
Since Sebastian is out of office right now - this is one of the reasons we're
involved - would you be ok with us submitting a new PR with our ch
https://github.com/PBHDK created https://github.com/llvm/llvm-project/pull/95220
This PR is based on the PR #90043 by @sebwolf-de, who has given us (@leunam99
and myself) [permission to continue his
work](https://github.com/llvm/llvm-project/pull/90043#issuecomment-2137455627).
The original PR
PBHDK wrote:
> Yes, you can just submit new PR, reference this one.
Done! Here it is: https://github.com/llvm/llvm-project/pull/95220
https://github.com/llvm/llvm-project/pull/90043
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists
@@ -0,0 +1,31 @@
+.. title:: clang-tidy - cppcoreguidelines-prefer-at-over-subscript-operator
+
+cppcoreguidelines-prefer-at-over-subscript-operator
+=
+
+This check flags all uses of ``operator[]`` where an equivalent (same
parameter and retur
https://github.com/PBHDK edited https://github.com/llvm/llvm-project/pull/95220
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PBHDK edited https://github.com/llvm/llvm-project/pull/95220
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PBHDK updated https://github.com/llvm/llvm-project/pull/95220
From 37292995de0c5aa87408586749795a97468d4725 Mon Sep 17 00:00:00 2001
From: Sebastian Wolf
Date: Wed, 17 Apr 2024 16:16:35 +0200
Subject: [PATCH 01/11] Enforce SL.con.3: Add check to replace operator[] with
at() o
https://github.com/PBHDK updated https://github.com/llvm/llvm-project/pull/95220
From 37292995de0c5aa87408586749795a97468d4725 Mon Sep 17 00:00:00 2001
From: Sebastian Wolf
Date: Wed, 17 Apr 2024 16:16:35 +0200
Subject: [PATCH 01/12] Enforce SL.con.3: Add check to replace operator[] with
at() o
https://github.com/PBHDK edited https://github.com/llvm/llvm-project/pull/95220
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PBHDK updated https://github.com/llvm/llvm-project/pull/95220
From 37292995de0c5aa87408586749795a97468d4725 Mon Sep 17 00:00:00 2001
From: Sebastian Wolf
Date: Wed, 17 Apr 2024 16:16:35 +0200
Subject: [PATCH 01/15] Enforce SL.con.3: Add check to replace operator[] with
at() o
https://github.com/PBHDK updated https://github.com/llvm/llvm-project/pull/95220
From 37292995de0c5aa87408586749795a97468d4725 Mon Sep 17 00:00:00 2001
From: Sebastian Wolf
Date: Wed, 17 Apr 2024 16:16:35 +0200
Subject: [PATCH 01/16] Enforce SL.con.3: Add check to replace operator[] with
at() o
@@ -0,0 +1,123 @@
+//===--- PreferAtOverSubscriptOperatorCheck.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/PBHDK updated https://github.com/llvm/llvm-project/pull/95220
From 37292995de0c5aa87408586749795a97468d4725 Mon Sep 17 00:00:00 2001
From: Sebastian Wolf
Date: Wed, 17 Apr 2024 16:16:35 +0200
Subject: [PATCH 01/17] Enforce SL.con.3: Add check to replace operator[] with
at() o
@@ -0,0 +1,40 @@
+//===--- PreferAtOverSubscriptOperatorCheck.h - clang-tidy --*- C++
-*-===//
+//===--- PreferMemberInitializerCheck.h - clang-tidy *- C++
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See htt
PBHDK wrote:
> Btw, I realize that this check is part of the [bounds
> profile](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#SS-bounds)
> (Bounds.4), so for consistency it should probably be named
> `cppcoreguidelines-pro-bounds-...`.
What do you think of:
`cppcoreguidelines-
PBHDK wrote:
> Btw, I realize that this check is part of the [bounds
> profile](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#SS-bounds)
> (Bounds.4), so for consistency it should probably be named
> `cppcoreguidelines-pro-bounds-...`. This becomes then the last remaining
> che
https://github.com/PBHDK updated https://github.com/llvm/llvm-project/pull/95220
From 37292995de0c5aa87408586749795a97468d4725 Mon Sep 17 00:00:00 2001
From: Sebastian Wolf
Date: Wed, 17 Apr 2024 16:16:35 +0200
Subject: [PATCH 01/18] Enforce SL.con.3: Add check to replace operator[] with
at() o
https://github.com/PBHDK updated https://github.com/llvm/llvm-project/pull/95220
From 37292995de0c5aa87408586749795a97468d4725 Mon Sep 17 00:00:00 2001
From: Sebastian Wolf
Date: Wed, 17 Apr 2024 16:16:35 +0200
Subject: [PATCH 01/19] Enforce SL.con.3: Add check to replace operator[] with
at() o
https://github.com/PBHDK updated https://github.com/llvm/llvm-project/pull/95220
From 37292995de0c5aa87408586749795a97468d4725 Mon Sep 17 00:00:00 2001
From: Sebastian Wolf
Date: Wed, 17 Apr 2024 16:16:35 +0200
Subject: [PATCH 01/21] Enforce SL.con.3: Add check to replace operator[] with
at() o
@@ -0,0 +1,40 @@
+//===--- PreferAtOverSubscriptOperatorCheck.h - clang-tidy --*- C++
-*-===//
+//===--- PreferMemberInitializerCheck.h - clang-tidy *- C++
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See htt
PBHDK wrote:
> I am adding @leunam99 and @PBHDK to the PR, who will contribute in the next
> few weeks.
Since we cannot push to this PR, we will be submitting a new PR with
@sebwolf-de's + our work, correct, @EugeneZelenko, @PiotrZSL, @HerrCai0907?
https://github.com/llvm/llvm-project/pull/90
@@ -0,0 +1,137 @@
+//===--- ProBoundsAvoidUncheckedContainerAccesses.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,137 @@
+//===--- ProBoundsAvoidUncheckedContainerAccesses.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,124 @@
+//===--- ProBoundsAvoidUncheckedContainerAccesses.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,124 @@
+//===--- ProBoundsAvoidUncheckedContainerAccesses.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/PBHDK edited https://github.com/llvm/llvm-project/pull/95220
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,40 @@
+//===--- ProBoundsAvoidUncheckedContainerAccesses.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,137 @@
+//===--- ProBoundsAvoidUncheckedContainerAccesses.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
@@ -160,6 +160,11 @@ New checks
Replaces nested ``std::min`` and ``std::max`` calls with an initializer list
where applicable.
+- New :doc:`cppcoreguidelines-pro-bounds-avoid-unchecked-container-accesses
PBHDK wrote:
Are you referring to a double "it" som
https://github.com/PBHDK updated https://github.com/llvm/llvm-project/pull/95220
From 37292995de0c5aa87408586749795a97468d4725 Mon Sep 17 00:00:00 2001
From: Sebastian Wolf
Date: Wed, 17 Apr 2024 16:16:35 +0200
Subject: [PATCH 01/22] Enforce SL.con.3: Add check to replace operator[] with
at() o
PBHDK wrote:
> The name sounds nice. Thanks.
> Please address the concerns here and in #90043 to always suggest `at` as
> well. An option to enable suggesting and providing a fix to use `at` (or
> `gsl::at`), like others have suggested, sounds like the best option.
Thank you for taking another
paulhdk wrote:
Hi all,
just giving this a polite bump.
Please do let us know if you have any questions or if there's anything we can
do to make reviewing easier.
https://github.com/llvm/llvm-project/pull/95220
___
cfe-commits mailing list
cfe-commits
paulhdk wrote:
Gentle bump. Thank you for taking a look!
https://github.com/llvm/llvm-project/pull/95220
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/paulhdk updated
https://github.com/llvm/llvm-project/pull/95220
Rate limit · GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Arial,sans-se
@@ -0,0 +1,227 @@
+// RUN: %check_clang_tidy -std=c++2b -check-suffix=DEFAULT %s \
+// RUN: cppcoreguidelines-pro-bounds-avoid-unchecked-container-accesses %t -- \
+// RUN: -config='{CheckOptions:
{cppcoreguidelines-pro-bounds-avoid-unchecked-container-accesses.ExcludeClasses:
"
@@ -0,0 +1,124 @@
+//===--- ProBoundsAvoidUncheckedContainerAccesses.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
paulhdk wrote:
Sorry for letting this sit for long!
I've addressed the most recent comments.
Based on what @leunam99 wrote above, the following questions are still
unresolved:
* It is still unclear to us how templates should be addressed when suggesting
fixes.
For instance, what should happe
@@ -0,0 +1,50 @@
+.. title:: clang-tidy -
cppcoreguidelines-pro-bounds-avoid-unchecked-container-accesses
+
+cppcoreguidelines-pro-bounds-avoid-unchecked-container-accesses
+===
+
+Flags calls to ``operator[]`` in STL co
https://github.com/paulhdk updated
https://github.com/llvm/llvm-project/pull/95220
Rate limit · GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Arial,sans-se
@@ -0,0 +1,50 @@
+.. title:: clang-tidy -
cppcoreguidelines-pro-bounds-avoid-unchecked-container-accesses
+
+cppcoreguidelines-pro-bounds-avoid-unchecked-container-accesses
+===
+
+Flags calls to ``operator[]`` in STL co
@@ -0,0 +1,227 @@
+// RUN: %check_clang_tidy -std=c++2b -check-suffix=DEFAULT %s \
paulhdk wrote:
Nice! Addressed in 642f5c311701e1476e84ddb04eb84105c75678a5.
Also discovered `check_clang_tidy.py`'s `-check-suffixes` option which came in
handy.
https://github.
@@ -0,0 +1,227 @@
+// RUN: %check_clang_tidy -std=c++2b -check-suffix=DEFAULT %s \
paulhdk wrote:
Again, good catch.
We have that in there because for some of our tests, we overload the subscript
operator to take no arguments, which is a C++23 feature. See my c
@@ -0,0 +1,50 @@
+.. title:: clang-tidy -
cppcoreguidelines-pro-bounds-avoid-unchecked-container-accesses
+
+cppcoreguidelines-pro-bounds-avoid-unchecked-container-accesses
+===
+
+Flags calls to ``operator[]`` in STL co
paulhdk wrote:
Hi all!
I've requested reviews from everyone who has reviewed the check so far.
Would be awesome if we could get this merged soon! Attaching my previous
comments with unresolved questions below.
> Based on what @leunam99 wrote above, the following questions are still
> unresolv
paulhdk wrote:
> LGTM for my changes, here a few nits that are just nice to have (doesn't much
> block PR). The only important change is [single ticks instead of double tick
> in default value of `ExcludeClasses`
> option](https://github.com/llvm/llvm-project/pull/95220#discussion_r2109589004)
@@ -136,6 +136,13 @@ New checks
Finds unintended character output from ``unsigned char`` and ``signed char``
to an ``ostream``.
+- New :doc:`cppcoreguidelines-pro-bounds-avoid-unchecked-container-accesses
+
`
+ check.
+
+ Flags calls to ``operator[]`` in STL containers
@@ -0,0 +1,51 @@
+.. title:: clang-tidy -
cppcoreguidelines-pro-bounds-avoid-unchecked-container-accesses
+
+cppcoreguidelines-pro-bounds-avoid-unchecked-container-accesses
+===
+
+Flags calls to ``operator[]`` in STL co
53 matches
Mail list logo