[clang-tools-extra] [clang-tidy] Add options to throw unannotated functions in `bugprone-exception-escape` (PR #168324)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 19 03:22:58 PST 2026


================
@@ -52,7 +52,7 @@ class ExceptionAnalyzer {
     using Throwables = llvm::SmallDenseMap<const Type *, ThrowInfo, 2>;
 
     static ExceptionInfo createUnknown() { return {State::Unknown}; }
-    static ExceptionInfo createNonThrowing() { return {State::Throwing}; }
+    static ExceptionInfo createNonThrowing() { return {State::NotThrowing}; }
----------------
zeyi2 wrote:

If I remember correctly, the reason why tests passed with the initial incorrect `createNonThrowing` (returning Throwing) is due to `analyzeDispatch` calling `filterIgnoredExceptions`, which in turn calls `reevaluateBehaviour`. Since the exception set was empty, `reevaluateBehaviour` correctly reset the state to `NotThrowing`, masking the initial bug.

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


More information about the cfe-commits mailing list