[clang-tools-extra] [clang-tidy] support string::contains (PR #110351)

2024-10-04 Thread Tommy Chen via cfe-commits
@@ -32,7 +33,8 @@ void ContainerContainsCheck::registerMatchers(MatchFinder *Finder) { const auto FindCall = cxxMemberCallExpr( - argumentCountIs(1), + anyOf(argumentCountIs(1), +allOf(argumentCountIs(2), hasArgument(1, cxxDefaultArg

[clang-tools-extra] [clang-tidy] support string::contains (PR #110351)

2024-10-04 Thread Tommy Chen via cfe-commits
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

[clang-tools-extra] [clang-tidy] support string::contains (PR #110351)

2024-10-04 Thread Tommy Chen via cfe-commits
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

[clang-tools-extra] [clang-tidy] support string::contains (PR #110351)

2024-10-04 Thread Tommy Chen via cfe-commits
@@ -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

[clang-tools-extra] [clang-tidy] support string::contains (PR #110351)

2024-10-04 Thread Tommy Chen via cfe-commits
@@ -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

[clang-tools-extra] [clang-tidy] support string::contains (PR #110351)

2024-10-04 Thread Tommy Chen via cfe-commits
@@ -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

[clang-tools-extra] [clang-tidy] support string::contains (PR #110351)

2024-10-04 Thread Tommy Chen via cfe-commits
@@ -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"

[clang-tools-extra] [clang-tidy] exclude CXXParenListInitExpr from RedundantCastingCheck (PR #109741)

2024-09-24 Thread Tommy Chen via cfe-commits
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

[clang-tools-extra] [clang-tidy] exclude CXXParenListInitExpr from RedundantCastingCheck (PR #109741)

2024-09-24 Thread Tommy Chen via 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

[clang-tools-extra] [clang-tidy] exclude CXXParenListInitExpr from RedundantCastingCheck (PR #109741)

2024-09-24 Thread Tommy Chen via 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/5] [clang-tidy] eclude CXXParenListInitExpr Exclude CXXParenListInit

[clang-tools-extra] [clang-tidy] exclude CXXParenListInitExpr from RedundantCastingCheck (PR #109741)

2024-09-24 Thread Tommy Chen via cfe-commits
@@ -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

[clang-tools-extra] [clang-tidy] exclude CXXParenListInitExpr from RedundantCastingCheck (PR #109741)

2024-09-24 Thread Tommy Chen via 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/4] [clang-tidy] eclude CXXParenListInitExpr Exclude CXXParenListInit

[clang-tools-extra] [clang-tidy] exclude CXXParenListInitExpr from RedundantCastingCheck (PR #109741)

2024-09-24 Thread Tommy Chen via cfe-commits
@@ -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

[clang-tools-extra] [clang-tidy] support string::contains (PR #110351)

2024-09-28 Thread Tommy Chen via cfe-commits
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

[clang-tools-extra] [clang-tidy] exclude CXXParenListInitExpr from RedundantCastingCheck (PR #109741)

2024-09-25 Thread Tommy Chen via 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/6] [clang-tidy] eclude CXXParenListInitExpr Exclude CXXParenListInit

[clang-tools-extra] [clang-tidy] exclude CXXParenListInitExpr from RedundantCastingCheck (PR #109741)

2024-09-25 Thread Tommy Chen via cfe-commits
@@ -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+

[clang-tools-extra] [clang-tidy] support different precisions (PR #130540)

2025-03-10 Thread Tommy Chen via cfe-commits
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

[clang-tools-extra] [clang-tidy] support different precisions (PR #130540)

2025-03-10 Thread Tommy Chen via cfe-commits
@@ -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

[clang-tools-extra] [clang-tidy] support different precisions (PR #130540)

2025-03-09 Thread Tommy Chen via cfe-commits
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

[clang-tools-extra] [clang-tidy] support different precisions (PR #130540)

2025-03-09 Thread Tommy Chen via cfe-commits
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

[clang-tools-extra] [clang-tidy] support different precisions (PR #130540)

2025-03-09 Thread Tommy Chen via cfe-commits
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

[clang-tools-extra] [clang-tidy] support different precisions (PR #130540)

2025-03-11 Thread Tommy Chen via 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/