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