@@ -32,7 +33,8 @@ void ContainerContainsCheck::registerMatchers(MatchFinder
*Finder) {
const auto FindCall =
cxxMemberCallExpr(
- argumentCountIs(1),
+ anyOf(argumentCountIs(1),
+allOf(argumentCountIs(2), hasArgument(1,
cxxDefaultArg
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/110351
>From b98e9a4d50d74c298096d2bd2d70ff4c0ef5c4a4 Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Sat, 28 Sep 2024 07:37:50 +
Subject: [PATCH 1/4] [clang-tidy] support string::contains
---
.../readability/Contai
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/110351
>From b98e9a4d50d74c298096d2bd2d70ff4c0ef5c4a4 Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Sat, 28 Sep 2024 07:37:50 +
Subject: [PATCH 1/5] [clang-tidy] support string::contains
---
.../readability/Contai
@@ -29,6 +29,43 @@ struct multimap {
bool contains(const Key &K) const;
};
+using size_t = decltype(sizeof(int));
+
+// Lightweight standin for std::string_view.
+template
+class basic_string_view {
+public:
+ basic_string_view();
+ basic_string_view(const basic_string_vi
@@ -94,12 +102,14 @@ void ContainerContainsCheck::registerMatchers(MatchFinder
*Finder) {
binaryOperator(hasLHS(Literal1), hasOperatorName(">"), hasRHS(CountCall))
.bind("negativeComparison"));
- // Find membership tests based on `find() == end()`.
+ // Find
@@ -453,3 +490,15 @@ void testOperandPermutations(std::map& Map) {
// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: use 'contains' to check
for membership [readability-container-contains]
// CHECK-FIXES: if (!Map.contains(0)) {};
}
+
+void testStringNops(std::string St
@@ -51,6 +53,12 @@ void ContainerContainsCheck::registerMatchers(MatchFinder
*Finder) {
const auto Literal0 = integerLiteral(equals(0));
const auto Literal1 = integerLiteral(equals(1));
+ const auto StringLikeClass = cxxRecordDecl(
+ hasAnyName("::std::basic_string"
https://github.com/dl8sd11 edited
https://github.com/llvm/llvm-project/pull/109741
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/109741
>From 13bc00c2ffb4238903b57c0a3c77424ed35279cc Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Mon, 23 Sep 2024 17:52:25 +
Subject: [PATCH 1/3] [clang-tidy] eclude CXXParenListInitExpr
Exclude CXXParenListInit
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/109741
>From 13bc00c2ffb4238903b57c0a3c77424ed35279cc Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Mon, 23 Sep 2024 17:52:25 +
Subject: [PATCH 1/5] [clang-tidy] eclude CXXParenListInitExpr
Exclude CXXParenListInit
@@ -183,6 +183,10 @@ Changes in existing checks
by adding the option `UseUpperCaseLiteralSuffix` to select the
case of the literal suffix in fixes.
+- Improved :doc:`readability-redundant-casting
+ ` check to
+ exclude `CXXParenListInitExpr` for the source expression mat
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/109741
>From 13bc00c2ffb4238903b57c0a3c77424ed35279cc Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Mon, 23 Sep 2024 17:52:25 +
Subject: [PATCH 1/4] [clang-tidy] eclude CXXParenListInitExpr
Exclude CXXParenListInit
@@ -183,6 +183,10 @@ Changes in existing checks
by adding the option `UseUpperCaseLiteralSuffix` to select the
case of the literal suffix in fixes.
+- Improved :doc:`readability-redundant-casting
+ ` check to
+ exclude `CXXParenListInitExpr` for the source expression mat
https://github.com/dl8sd11 created
https://github.com/llvm/llvm-project/pull/110351
Starting from c++23, we can replace `std::string::find() == std::string::npos`
with `std::string.contains()` . #109327
Currently, this is WIP because there are two limitations:
1. False positive: SubStr type i
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/109741
>From 13bc00c2ffb4238903b57c0a3c77424ed35279cc Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Mon, 23 Sep 2024 17:52:25 +
Subject: [PATCH 1/6] [clang-tidy] eclude CXXParenListInitExpr
Exclude CXXParenListInit
@@ -1,8 +1,8 @@
-// RUN: %check_clang_tidy -std=c++11-or-later %s readability-redundant-casting
%t -- -- -fno-delayed-template-parsing
-// RUN: %check_clang_tidy -std=c++11-or-later -check-suffix=,MACROS %s
readability-redundant-casting %t -- \
+// RUN: %check_clang_tidy -std=c+
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/130540
>From 092135bbb3536167f0cad11e7320e52886c022cc Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Mon, 10 Mar 2025 02:56:14 +
Subject: [PATCH 1/3] [clang-tidy] support different precisions
Support float and long
@@ -91,8 +91,12 @@ struct MatchBuilder {
auto matchMathCall(const StringRef FunctionName,
const Matcher ArgumentMatcher) const {
+auto HasAnyPrecisionName =
+anyOf(hasName(FunctionName), hasName((FunctionName + "l").str()),
d
https://github.com/dl8sd11 created
https://github.com/llvm/llvm-project/pull/130540
Support float and long double versions of the math functions for
UseStdNumbersCheck.
For example, after this commit the check is able to catch `sqrtf(2)` and
`expl(1)`.
Fixes: #130325
>From 092135bbb3536167f
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/130540
>From 092135bbb3536167f0cad11e7320e52886c022cc Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Mon, 10 Mar 2025 02:56:14 +
Subject: [PATCH] [clang-tidy] support different precisions
Support float and long doub
https://github.com/dl8sd11 ready_for_review
https://github.com/llvm/llvm-project/pull/130540
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -136,6 +136,10 @@ Changes in existing checks
` check by updating suppress
warnings logic for ``nullptr`` in ``std::find``.
+- Improved :doc:`modernize-use-std-numbers
+ ` check to support math
functions
dl8sd11 wrote:
Done.
https://github.com/llvm/
https://github.com/dl8sd11 created
https://github.com/llvm/llvm-project/pull/140388
#139618
>From 5bc074dadddb094bf954388a95ecb818abe17b56 Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Sat, 17 May 2025 17:23:26 +
Subject: [PATCH] [clang-tidy] Add avoid-pragma-once.
---
.../portability/A
@@ -0,0 +1,5 @@
+// RUN: %check_clang_tidy %s portability-avoid-pragma-once %t \
+// RUN: -- -- -isystem %S/Inputs/avoid-pragma-once
+
+#include
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: Avoid pragma once.
[portability-avoid-pragma-once]
dl8sd11 wrote:
I'm
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/140388
>From 5bc074dadddb094bf954388a95ecb818abe17b56 Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Sat, 17 May 2025 17:23:26 +
Subject: [PATCH 1/2] [clang-tidy] Add avoid-pragma-once.
---
.../portability/AvoidPra
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/140388
>From 5bc074dadddb094bf954388a95ecb818abe17b56 Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Sat, 17 May 2025 17:23:26 +
Subject: [PATCH 1/3] [clang-tidy] Add avoid-pragma-once.
---
.../portability/AvoidPra
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/140388
>From 5bc074dadddb094bf954388a95ecb818abe17b56 Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Sat, 17 May 2025 17:23:26 +
Subject: [PATCH 1/4] [clang-tidy] Add avoid-pragma-once.
---
.../portability/AvoidPra
https://github.com/dl8sd11 ready_for_review
https://github.com/llvm/llvm-project/pull/140388
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,5 @@
+// RUN: %check_clang_tidy %s portability-avoid-pragma-once %t \
+// RUN: -- -- -isystem %S/Inputs/avoid-pragma-once
+
+#include
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: Avoid pragma once.
[portability-avoid-pragma-once]
dl8sd11 wrote:
Tha
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/140388
>From 5bc074dadddb094bf954388a95ecb818abe17b56 Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Sat, 17 May 2025 17:23:26 +
Subject: [PATCH 1/5] [clang-tidy] Add avoid-pragma-once.
---
.../portability/AvoidPra
dl8sd11 wrote:
Fixed!
First time adding a clang-tidy check! Apologies for missing the conventions,
and huge thanks for your time reviewing.
https://github.com/llvm/llvm-project/pull/140388
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/140388
>From 5bc074dadddb094bf954388a95ecb818abe17b56 Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Sat, 17 May 2025 17:23:26 +
Subject: [PATCH 1/8] [clang-tidy] Add avoid-pragma-once.
---
.../portability/AvoidPra
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/140388
>From 5bc074dadddb094bf954388a95ecb818abe17b56 Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Sat, 17 May 2025 17:23:26 +
Subject: [PATCH 1/9] [clang-tidy] Add avoid-pragma-once.
---
.../portability/AvoidPra
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/140388
>From 5bc074dadddb094bf954388a95ecb818abe17b56 Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Sat, 17 May 2025 17:23:26 +
Subject: [PATCH 1/6] [clang-tidy] Add avoid-pragma-once.
---
.../portability/AvoidPra
https://github.com/dl8sd11 updated
https://github.com/llvm/llvm-project/pull/140388
>From 5bc074dadddb094bf954388a95ecb818abe17b56 Mon Sep 17 00:00:00 2001
From: dl8sd11
Date: Sat, 17 May 2025 17:23:26 +
Subject: [PATCH 1/7] [clang-tidy] Add avoid-pragma-once.
---
.../portability/AvoidPra
@@ -0,0 +1,50 @@
+//===--- AvoidPragmaOnceCheck.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
36 matches
Mail list logo