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
@@ -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
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
42 matches
Mail list logo