22 const auto WarningMessage =
23 cat(
"prefer absl::Cleanup's class template argument "
24 "deduction pattern in C++17 and higher");
27 declStmt(hasSingleDecl(varDecl(
28 hasType(autoType()), hasTypeLoc(typeLoc().bind(
"auto_type_loc")),
29 hasInitializer(hasDescendant(
30 callExpr(callee(functionDecl(hasName(
"absl::MakeCleanup"))),
32 .bind(
"make_cleanup_call")))))),
33 {changeTo(node(
"auto_type_loc"), cat(
"absl::Cleanup")),
34 changeTo(node(
"make_cleanup_call"), cat(callArgs(
"make_cleanup_call")))},
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.