[clang-tools-extra] [clang-tidy] Fix false negatives in performance-faster-string-find with libstdc++ (PR #185559)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 9 19:53:56 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/performance/FasterStringFindCheck.cpp clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.h clang-tools-extra/test/clang-tidy/checkers/performance/faster-string-find.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/performance/FasterStringFindCheck.cpp b/clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.cpp
index 96ad60bb2..1d9325166 100644
--- a/clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.cpp
@@ -58,9 +58,8 @@ void FasterStringFindCheck::registerMatchers(MatchFinder *Finder) {
const auto SingleChar =
ignoringParenCasts(stringLiteral(hasSize(1)).bind("literal"));
- const auto StringExpr =
- expr(hasType(hasUnqualifiedDesugaredType(recordType(
- hasDeclaration(recordDecl(hasAnyName(StringLikeClasses)))))));
+ const auto StringExpr = expr(hasType(hasUnqualifiedDesugaredType(
+ recordType(hasDeclaration(recordDecl(hasAnyName(StringLikeClasses)))))));
const auto InterestingStringFunction = hasAnyName(
"find", "rfind", "find_first_of", "find_first_not_of", "find_last_of",
``````````
</details>
https://github.com/llvm/llvm-project/pull/185559
More information about the cfe-commits
mailing list