[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
Fri Feb 6 05:53:55 PST 2026


================
@@ -124,13 +130,28 @@ class ExceptionAnalyzer {
     /// after filtering.
     bool ContainsUnknown;
 
+    /// True if the entity is determined to be Throwing due to an unknown cause,
+    /// based on analyzer configuration.
+    bool ThrowsUnknown = false;
+
     /// 'ThrownException' is empty if the 'Behaviour' is either 'NotThrowing' or
     /// 'Unknown'.
     Throwables ThrownExceptions;
   };
 
   ExceptionAnalyzer() = default;
 
+  enum class UnknownHandlingBehavior { Ignore, TreatAsThrowing };
+
+  void setUnannotatedFunctionsBehavior(UnknownHandlingBehavior Behavior) {
+    AssumeUnannotatedFunctionsAsThrowing =
+        Behavior == UnknownHandlingBehavior::TreatAsThrowing;
+  }
+  void setMissingDefinitionsBehavior(UnknownHandlingBehavior Behavior) {
+    AssumeMissingDefinitionsFunctionsAsThrowing =
+        Behavior == UnknownHandlingBehavior::TreatAsThrowing;
+  }
----------------
zeyi2 wrote:

Fixed, thanks for reviewing!

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


More information about the cfe-commits mailing list