[clang] [clang-tools-extra] [clang-tidy][mlir] Add check for passing value type by reference. (PR #179882)

via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 19 10:46:49 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/llvm/AvoidPassingAsRefCheck.cpp clang-tools-extra/clang-tidy/llvm/AvoidPassingAsRefCheck.h clang-tools-extra/test/clang-tidy/checkers/llvm/avoid-passing-as-ref.cpp clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp clang/include/clang/ASTMatchers/ASTMatchers.h --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/llvm/AvoidPassingAsRefCheck.cpp b/clang-tools-extra/clang-tidy/llvm/AvoidPassingAsRefCheck.cpp
index 70d1eacec..06baf7055 100644
--- a/clang-tools-extra/clang-tidy/llvm/AvoidPassingAsRefCheck.cpp
+++ b/clang-tools-extra/clang-tidy/llvm/AvoidPassingAsRefCheck.cpp
@@ -30,9 +30,8 @@ void AvoidPassingAsRefCheck::registerMatchers(MatchFinder *Finder) {
     return;
 
   std::vector<ast_matchers::internal::Matcher<CXXRecordDecl>> Matchers;
-  for (const auto &Name : ClassNameList) {
+  for (const auto &Name : ClassNameList)
     Matchers.push_back(isSameOrDerivedFrom(std::string(Name)));
-  }
 
   // Match parameters that are references to classes derived from any class in
   // ClassNameList.

``````````

</details>


https://github.com/llvm/llvm-project/pull/179882


More information about the cfe-commits mailing list