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 cpp,h --
clang-tools-extra/clang-tidy/misc/UseBulkInsertCheck.cpp
clang-tools-extra/clang-tidy/misc/UseBulkInsertCheck.h
clang-tools-extra/test/clang-tidy/checkers/misc/use-bulk-insert.cpp
clang-tools-extra/clang-tidy/misc/MiscTidyModule.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/misc/MiscTidyModule.cpp
b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
index 882912c38..aa1bdba54 100644
--- a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
@@ -97,8 +97,7 @@ public:
"misc-unused-using-decls");
CheckFactories.registerCheck<UseAnonymousNamespaceCheck>(
"misc-use-anonymous-namespace");
- CheckFactories.registerCheck<UseBulkInsertCheck>(
- "misc-use-bulk-insert");
+ CheckFactories.registerCheck<UseBulkInsertCheck>("misc-use-bulk-insert");
CheckFactories.registerCheck<UseInternalLinkageCheck>(
"misc-use-internal-linkage");
}
diff --git a/clang-tools-extra/clang-tidy/misc/UseBulkInsertCheck.cpp
b/clang-tools-extra/clang-tidy/misc/UseBulkInsertCheck.cpp
index 16111a05d..e13c1e1d1 100644
--- a/clang-tools-extra/clang-tidy/misc/UseBulkInsertCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/UseBulkInsertCheck.cpp
@@ -21,33 +21,26 @@ void UseBulkInsertCheck::registerMatchers(MatchFinder
*Finder) {
hasRangeInit(expr().bind("range")),
hasBody(compoundStmt(
statementCountIs(1),
- hasAnySubstatement(cxxMemberCallExpr(
- callee(memberExpr(
- ofClass(cxxRecordDecl(hasAnyName(
+ hasAnySubstatement(
+ cxxMemberCallExpr(
+ callee(memberExpr(ofClass(cxxRecordDecl(hasAnyName(
"::std::set", "::std::map", "::std::multiset",
"::std::multimap", "::std::unordered_set",
- "::std::unordered_map",
- "::std::unordered_multiset",
+ "::std::unordered_map", "::std::unordered_multiset",
"::std::unordered_multimap"))))),
- argumentCountIs(1),
- hasArgument(
- 0, ignoringParenImpCasts(
- declRefExpr(to(varDecl().bind("insert_arg"))))))
- .bind("insert_call")))))
+ argumentCountIs(1),
+ hasArgument(0, ignoringParenImpCasts(declRefExpr(
+ to(varDecl().bind("insert_arg"))))))
+ .bind("insert_call")))))
.bind("for_range"),
this);
}
-void UseBulkInsertCheck::check(
- const MatchFinder::MatchResult &Result) {
- const auto *Loop =
- Result.Nodes.getNodeAs<CXXForRangeStmt>("for_range");
- const auto *LoopVar =
- Result.Nodes.getNodeAs<VarDecl>("loop_var");
- const auto *InsertArg =
- Result.Nodes.getNodeAs<VarDecl>("insert_arg");
- const auto *Range =
- Result.Nodes.getNodeAs<Expr>("range");
+void UseBulkInsertCheck::check(const MatchFinder::MatchResult &Result) {
+ const auto *Loop = Result.Nodes.getNodeAs<CXXForRangeStmt>("for_range");
+ const auto *LoopVar = Result.Nodes.getNodeAs<VarDecl>("loop_var");
+ const auto *InsertArg = Result.Nodes.getNodeAs<VarDecl>("insert_arg");
+ const auto *Range = Result.Nodes.getNodeAs<Expr>("range");
const auto *InsertCall =
Result.Nodes.getNodeAs<CXXMemberCallExpr>("insert_call");
@@ -69,12 +62,10 @@ void UseBulkInsertCheck::check(
const LangOptions &LangOpts = Result.Context->getLangOpts();
StringRef ObjectText = Lexer::getSourceText(
- CharSourceRange::getTokenRange(Object->getSourceRange()), SM,
- LangOpts);
+ CharSourceRange::getTokenRange(Object->getSourceRange()), SM, LangOpts);
StringRef RangeText = Lexer::getSourceText(
- CharSourceRange::getTokenRange(Range->getSourceRange()), SM,
- LangOpts);
+ CharSourceRange::getTokenRange(Range->getSourceRange()), SM, LangOpts);
if (ObjectText.empty() || RangeText.empty())
return;
@@ -90,7 +81,7 @@ void UseBulkInsertCheck::check(
"use bulk insertion instead of inserting elements one at a time")
<< FixItHint::CreateReplacement(
CharSourceRange::getTokenRange(Loop->getBeginLoc(),
- Loop->getEndLoc()),
+ Loop->getEndLoc()),
Replacement);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/226742
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits