[clang-tools-extra] [clang-tidy][NFC] Add helper for deprecated check aliases (PR #189522)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 10 10:14:08 PDT 2026
================
@@ -0,0 +1,19 @@
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_CHECKUTILS_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_CHECKUTILS_H
+
+#include "../ClangTidyDiagnosticConsumer.h"
+
+namespace clang::tidy::utils {
+
+/// Returns true when a check is running under a deprecated name and the user
+/// should be prompted to migrate to CanonicalName.
+inline bool isDeprecatedAlias(const ClangTidyContext &Context,
+ StringRef DeprecatedName,
+ StringRef CanonicalName) {
+ return Context.isCheckEnabled(DeprecatedName) &&
+ !Context.isCheckEnabled(CanonicalName);
----------------
vbvictor wrote:
On second thought, can we instead pass `diag()` object here and make diagnostic as well?
So we don't have to duplicate `if(..) diag("you have deprecated..")`.
I suspect we wouldn't be able to test it in UnitTests
https://github.com/llvm/llvm-project/pull/189522
More information about the cfe-commits
mailing list