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

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 7 05:07:29 PST 2026


================
@@ -483,10 +486,20 @@ ExceptionAnalyzer::ExceptionInfo ExceptionAnalyzer::throwsException(
     }
 
     CallStack.erase(Func);
+    // Optionally treat unannotated functions as potentially throwing if they
+    // are not explicitly non-throwing and no throw was discovered.
+    if (AssumeUnannotatedThrowing &&
+        Result.getBehaviour() == State::NotThrowing && canThrow(Func)) {
+      Result.registerUnknownException();
+      return Result;
----------------
vbvictor wrote:

Useless return? We will anyway return on the next line

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


More information about the cfe-commits mailing list