[clang-tools-extra] [clang-tidy] Rename hicpp-exception-baseclass to bugprone-exception-baseclass (PR #183474)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 5 08:35:26 PST 2026
================
@@ -0,0 +1,31 @@
+.. title:: clang-tidy - bugprone-std-exception-baseclass
+
+bugprone-std-exception-baseclass
+================================
+
+Ensure that every value that in a ``throw`` expression is an instance of
+``std::exception``.
+
+Exception types should inherit from ``std::exception`` so they can be
+handled consistently and caught as ``std::exception``.
----------------
vbvictor wrote:
This is too generic, can we:
Deriving all exceptions from ``std::exception`` ensures callers can catch every possible exception through a single catch block and always have access to ``what()`` method for diagnostics. Throwing arbitrary types creates hidden contracts, breaks interoperability with the standard library, and risks triggering a program termination.
https://github.com/llvm/llvm-project/pull/183474
More information about the cfe-commits
mailing list