[clang-tools-extra] [clang-tidy] Add fine-graded configuration for 'bugprone-exception-escape' (PR #164081)

via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 18 05:50:17 PDT 2025


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/test/clang-tidy/checkers/bugprone/exception-escape-options.cpp clang-tools-extra/clang-tidy/bugprone/ExceptionEscapeCheck.cpp clang-tools-extra/clang-tidy/bugprone/ExceptionEscapeCheck.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/bugprone/ExceptionEscapeCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ExceptionEscapeCheck.cpp
index 02baa1f72..b07aad09e 100644
--- a/clang-tools-extra/clang-tidy/bugprone/ExceptionEscapeCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/ExceptionEscapeCheck.cpp
@@ -75,15 +75,18 @@ void ExceptionEscapeCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(
       functionDecl(
           isDefinition(),
-          anyOf(CheckNothrowFunctions ? isNoThrow() : Nothing,
-                allOf(anyOf(CheckDestructors ? cxxDestructorDecl() : Nothing,
-                            CheckMoveMemberFunctions ? anyOf(cxxConstructorDecl(isMoveConstructor()),
-                            cxxMethodDecl(isMoveAssignmentOperator())) : Nothing, 
-                            CheckMain ? isMain() : Nothing,
-                            allOf(isEnabled(CheckedSwapFunctions),
-                                  hasAtLeastOneParameter())),
-                      unless(isExplicitThrow())),
-                isEnabled(FunctionsThatShouldNotThrow)))
+          anyOf(
+              CheckNothrowFunctions ? isNoThrow() : Nothing,
+              allOf(anyOf(CheckDestructors ? cxxDestructorDecl() : Nothing,
+                          CheckMoveMemberFunctions
+                              ? anyOf(cxxConstructorDecl(isMoveConstructor()),
+                                      cxxMethodDecl(isMoveAssignmentOperator()))
+                              : Nothing,
+                          CheckMain ? isMain() : Nothing,
+                          allOf(isEnabled(CheckedSwapFunctions),
+                                hasAtLeastOneParameter())),
+                    unless(isExplicitThrow())),
+              isEnabled(FunctionsThatShouldNotThrow)))
           .bind("thrower"),
       this);
 }

``````````

</details>


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


More information about the cfe-commits mailing list