https://github.com/IamYJLee created 
https://github.com/llvm/llvm-project/pull/183474

Part of the work in https://github.com/llvm/llvm-project/issues/183462.

Closes https://github.com/llvm/llvm-project/issues/183463.

>From 1c94a3dc9b1a9bbf9ac10e65e78565b0e9e63536 Mon Sep 17 00:00:00 2001
From: LeeYoungJoon <[email protected]>
Date: Thu, 26 Feb 2026 17:16:46 +0900
Subject: [PATCH 1/2] [clang-tidy] Rename hicpp-exception-baseclass to
 bugprone-exception-baseclass

---
 .../clang-tidy/bugprone/BugproneTidyModule.cpp         |  3 +++
 clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt   |  1 +
 .../{hicpp => bugprone}/ExceptionBaseclassCheck.cpp    |  4 ++--
 .../{hicpp => bugprone}/ExceptionBaseclassCheck.h      | 10 +++++-----
 clang-tools-extra/clang-tidy/hicpp/CMakeLists.txt      |  1 -
 clang-tools-extra/clang-tidy/hicpp/HICPPTidyModule.cpp |  4 +---
 clang-tools-extra/clangd/TidyFastChecks.inc            |  2 +-
 .../checks/{hicpp => bugprone}/exception-baseclass.rst |  4 ++--
 clang-tools-extra/docs/clang-tidy/checks/list.rst      |  2 +-
 .../clang-tidy/checkers/hicpp/exception-baseclass.cpp  |  2 +-
 10 files changed, 17 insertions(+), 16 deletions(-)
 rename clang-tools-extra/clang-tidy/{hicpp => 
bugprone}/ExceptionBaseclassCheck.cpp (97%)
 rename clang-tools-extra/clang-tidy/{hicpp => 
bugprone}/ExceptionBaseclassCheck.h (77%)
 rename clang-tools-extra/docs/clang-tidy/checks/{hicpp => 
bugprone}/exception-baseclass.rst (89%)

diff --git a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp 
b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
index 310184037afbd..45bce2aabbed0 100644
--- a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
@@ -29,6 +29,7 @@
 #include "DynamicStaticInitializersCheck.h"
 #include "EasilySwappableParametersCheck.h"
 #include "EmptyCatchCheck.h"
+#include "ExceptionBaseclassCheck.h"
 #include "ExceptionCopyConstructorThrowsCheck.h"
 #include "ExceptionEscapeCheck.h"
 #include "FloatLoopCounterCheck.h"
@@ -158,6 +159,8 @@ class BugproneModule : public ClangTidyModule {
     CheckFactories.registerCheck<EasilySwappableParametersCheck>(
         "bugprone-easily-swappable-parameters");
     CheckFactories.registerCheck<EmptyCatchCheck>("bugprone-empty-catch");
+    CheckFactories.registerCheck<ExceptionBaseclassCheck>(
+        "bugprone-exception-baseclass");
     CheckFactories.registerCheck<ExceptionCopyConstructorThrowsCheck>(
         "bugprone-exception-copy-constructor-throws");
     CheckFactories.registerCheck<ExceptionEscapeCheck>(
diff --git a/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt 
b/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
index 96ad671d03b39..e272793b4b21f 100644
--- a/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
@@ -26,6 +26,7 @@ add_clang_library(clangTidyBugproneModule STATIC
   DynamicStaticInitializersCheck.cpp
   EasilySwappableParametersCheck.cpp
   EmptyCatchCheck.cpp
+  ExceptionBaseclassCheck.cpp
   ExceptionCopyConstructorThrowsCheck.cpp
   ExceptionEscapeCheck.cpp
   FloatLoopCounterCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/hicpp/ExceptionBaseclassCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/ExceptionBaseclassCheck.cpp
similarity index 97%
rename from clang-tools-extra/clang-tidy/hicpp/ExceptionBaseclassCheck.cpp
rename to clang-tools-extra/clang-tidy/bugprone/ExceptionBaseclassCheck.cpp
index 71b82875c09a0..625ed48ef3cf5 100644
--- a/clang-tools-extra/clang-tidy/hicpp/ExceptionBaseclassCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/ExceptionBaseclassCheck.cpp
@@ -12,7 +12,7 @@
 
 using namespace clang::ast_matchers;
 
-namespace clang::tidy::hicpp {
+namespace clang::tidy::bugprone {
 
 void ExceptionBaseclassCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(
@@ -54,4 +54,4 @@ void ExceptionBaseclassCheck::check(const 
MatchFinder::MatchResult &Result) {
     diag(TypeDecl->getBeginLoc(), "type defined here", DiagnosticIDs::Note);
 }
 
-} // namespace clang::tidy::hicpp
+} // namespace clang::tidy::bugprone
diff --git a/clang-tools-extra/clang-tidy/hicpp/ExceptionBaseclassCheck.h 
b/clang-tools-extra/clang-tidy/bugprone/ExceptionBaseclassCheck.h
similarity index 77%
rename from clang-tools-extra/clang-tidy/hicpp/ExceptionBaseclassCheck.h
rename to clang-tools-extra/clang-tidy/bugprone/ExceptionBaseclassCheck.h
index 800e7ac9663d5..4a589aebde99f 100644
--- a/clang-tools-extra/clang-tidy/hicpp/ExceptionBaseclassCheck.h
+++ b/clang-tools-extra/clang-tidy/bugprone/ExceptionBaseclassCheck.h
@@ -6,12 +6,12 @@
 //
 
//===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_HICPP_EXCEPTIONBASECLASSCHECK_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_HICPP_EXCEPTIONBASECLASSCHECK_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_EXCEPTIONBASECLASSCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_EXCEPTIONBASECLASSCHECK_H
 
 #include "../ClangTidyCheck.h"
 
-namespace clang::tidy::hicpp {
+namespace clang::tidy::bugprone {
 
 /// Check for thrown exceptions and enforce they are all derived from
 /// std::exception.
@@ -29,6 +29,6 @@ class ExceptionBaseclassCheck : public ClangTidyCheck {
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 };
 
-} // namespace clang::tidy::hicpp
+} // namespace clang::tidy::bugprone
 
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_HICPP_EXCEPTIONBASECLASSCHECK_H
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_EXCEPTIONBASECLASSCHECK_H
diff --git a/clang-tools-extra/clang-tidy/hicpp/CMakeLists.txt 
b/clang-tools-extra/clang-tidy/hicpp/CMakeLists.txt
index 2f31d168e65c0..e3fc26d662132 100644
--- a/clang-tools-extra/clang-tidy/hicpp/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/hicpp/CMakeLists.txt
@@ -4,7 +4,6 @@ set(LLVM_LINK_COMPONENTS
   )
 
 add_clang_library(clangTidyHICPPModule STATIC
-  ExceptionBaseclassCheck.cpp
   HICPPTidyModule.cpp
   IgnoredRemoveResultCheck.cpp
   MultiwayPathsCoveredCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/hicpp/HICPPTidyModule.cpp 
b/clang-tools-extra/clang-tidy/hicpp/HICPPTidyModule.cpp
index 2e0e64fbcd2a1..4ea7eaf5b5973 100644
--- a/clang-tools-extra/clang-tidy/hicpp/HICPPTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/hicpp/HICPPTidyModule.cpp
@@ -8,6 +8,7 @@
 
 #include "../ClangTidy.h"
 #include "../ClangTidyModule.h"
+#include "../bugprone/ExceptionBaseclassCheck.h"
 #include "../bugprone/UndelegatedConstructorCheck.h"
 #include "../bugprone/UseAfterMoveCheck.h"
 #include "../cppcoreguidelines/AvoidGotoCheck.h"
@@ -34,7 +35,6 @@
 #include "../readability/FunctionSizeCheck.h"
 #include "../readability/NamedParameterCheck.h"
 #include "../readability/UppercaseLiteralSuffixCheck.h"
-#include "ExceptionBaseclassCheck.h"
 #include "IgnoredRemoveResultCheck.h"
 #include "MultiwayPathsCoveredCheck.h"
 #include "NoAssemblerCheck.h"
@@ -55,8 +55,6 @@ class HICPPModule : public ClangTidyModule {
         "hicpp-braces-around-statements");
     CheckFactories.registerCheck<modernize::DeprecatedHeadersCheck>(
         "hicpp-deprecated-headers");
-    CheckFactories.registerCheck<ExceptionBaseclassCheck>(
-        "hicpp-exception-baseclass");
     CheckFactories.registerCheck<IgnoredRemoveResultCheck>(
         "hicpp-ignored-remove-result");
     CheckFactories.registerCheck<MultiwayPathsCoveredCheck>(
diff --git a/clang-tools-extra/clangd/TidyFastChecks.inc 
b/clang-tools-extra/clangd/TidyFastChecks.inc
index de1a025602fa9..e5d7711b201cb 100644
--- a/clang-tools-extra/clangd/TidyFastChecks.inc
+++ b/clang-tools-extra/clangd/TidyFastChecks.inc
@@ -63,6 +63,7 @@ FAST(bugprone-dangling-handle, -0.0)
 FAST(bugprone-dynamic-static-initializers, 0.0)
 FAST(bugprone-easily-swappable-parameters, 2.0)
 FAST(bugprone-empty-catch, 1.0)
+FAST(bugprone-exception-baseclass, -1.0)
 FAST(bugprone-exception-escape, 0.0)
 FAST(bugprone-fold-init-type, 1.0)
 FAST(bugprone-forward-declaration-namespace, 0.0)
@@ -247,7 +248,6 @@ FAST(hicpp-avoid-c-arrays, 1.0)
 FAST(hicpp-avoid-goto, -0.0)
 FAST(hicpp-braces-around-statements, 0.0)
 FAST(hicpp-deprecated-headers, 1.0)
-FAST(hicpp-exception-baseclass, -1.0)
 FAST(hicpp-explicit-conversions, 1.0)
 FAST(hicpp-function-size, 1.0)
 FAST(hicpp-ignored-remove-result, 3.0)
diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/hicpp/exception-baseclass.rst 
b/clang-tools-extra/docs/clang-tidy/checks/bugprone/exception-baseclass.rst
similarity index 89%
rename from 
clang-tools-extra/docs/clang-tidy/checks/hicpp/exception-baseclass.rst
rename to 
clang-tools-extra/docs/clang-tidy/checks/bugprone/exception-baseclass.rst
index 7a1c1a07c49e3..b166df8897f8b 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/hicpp/exception-baseclass.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/exception-baseclass.rst
@@ -1,6 +1,6 @@
-.. title:: clang-tidy - hicpp-exception-baseclass
+.. title:: clang-tidy - bugprone-exception-baseclass
 
-hicpp-exception-baseclass
+bugprone-exception-baseclass
 =========================
 
 Ensure that every value that in a ``throw`` expression is an instance of
diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst 
b/clang-tools-extra/docs/clang-tidy/checks/list.rst
index c475870ed7b31..e81ec6a85419d 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -99,6 +99,7 @@ Clang-Tidy Checks
    :doc:`bugprone-dynamic-static-initializers 
<bugprone/dynamic-static-initializers>`,
    :doc:`bugprone-easily-swappable-parameters 
<bugprone/easily-swappable-parameters>`,
    :doc:`bugprone-empty-catch <bugprone/empty-catch>`,
+   :doc:`bugprone-exception-baseclass <bugprone/exception-baseclass>`,
    :doc:`bugprone-exception-copy-constructor-throws 
<bugprone/exception-copy-constructor-throws>`,
    :doc:`bugprone-exception-escape <bugprone/exception-escape>`,
    :doc:`bugprone-float-loop-counter <bugprone/float-loop-counter>`,
@@ -240,7 +241,6 @@ Clang-Tidy Checks
    :doc:`google-runtime-int <google/runtime-int>`,
    :doc:`google-runtime-operator <google/runtime-operator>`,
    :doc:`google-upgrade-googletest-case <google/upgrade-googletest-case>`, 
"Yes"
-   :doc:`hicpp-exception-baseclass <hicpp/exception-baseclass>`,
    :doc:`hicpp-ignored-remove-result <hicpp/ignored-remove-result>`,
    :doc:`hicpp-multiway-paths-covered <hicpp/multiway-paths-covered>`,
    :doc:`hicpp-no-assembler <hicpp/no-assembler>`,
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/hicpp/exception-baseclass.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/hicpp/exception-baseclass.cpp
index b5e405a691848..4bf52936c0b63 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/hicpp/exception-baseclass.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/hicpp/exception-baseclass.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s hicpp-exception-baseclass %t -- -- 
-fcxx-exceptions
+// RUN: %check_clang_tidy %s bugprone-exception-baseclass %t -- -- 
-fcxx-exceptions
 
 namespace std {
 class exception {};

>From 1aee8d157e4eb6d4b130e1419da21c45179ecc66 Mon Sep 17 00:00:00 2001
From: LeeYoungJoon <[email protected]>
Date: Thu, 26 Feb 2026 17:28:42 +0900
Subject: [PATCH 2/2] [clang-tidy] Move test case

---
 .../checkers/{hicpp => bugprone}/exception-baseclass.cpp          | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename clang-tools-extra/test/clang-tidy/checkers/{hicpp => 
bugprone}/exception-baseclass.cpp (100%)

diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/hicpp/exception-baseclass.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-baseclass.cpp
similarity index 100%
rename from 
clang-tools-extra/test/clang-tidy/checkers/hicpp/exception-baseclass.cpp
rename to 
clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-baseclass.cpp

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to