clang-tools 23.0.0git
CheckUtils.h
Go to the documentation of this file.
1#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_CHECKUTILS_H
2#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_CHECKUTILS_H
3
4#include "../ClangTidyCheck.h"
5
6namespace clang::tidy::utils {
7
8/// Emits a configuration diagnostic when a deprecated check alias is enabled
9/// and the canonical check name is not also enabled.
11 const ClangTidyContext &Context,
12 StringRef DeprecatedName,
13 StringRef CanonicalName) {
14 if (!Context.isCheckEnabled(DeprecatedName) ||
15 Context.isCheckEnabled(CanonicalName))
16 return;
17
18 Check.configurationDiag(
19 "'%0' check is deprecated and will be removed in a future release; "
20 "consider using '%1' instead")
21 << DeprecatedName << CanonicalName;
22}
23
24} // namespace clang::tidy::utils
25
26#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_CHECKUTILS_H
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
bool isCheckEnabled(StringRef CheckName) const
Returns true if the check is enabled for the CurrentFile.
void diagDeprecatedCheckAlias(ClangTidyCheck &Check, const ClangTidyContext &Context, StringRef DeprecatedName, StringRef CanonicalName)
Emits a configuration diagnostic when a deprecated check alias is enabled and the canonical check nam...
Definition CheckUtils.h:10