10 #include "clang/AST/ASTContext.h"
11 #include "clang/ASTMatchers/ASTMatchFinder.h"
17 namespace cppcoreguidelines {
19 void ProTypeConstCastCheck::registerMatchers(MatchFinder *Finder) {
20 Finder->addMatcher(cxxConstCastExpr().bind(
"cast"),
this);
23 void ProTypeConstCastCheck::check(
const MatchFinder::MatchResult &Result) {
24 const auto *MatchedCast = Result.Nodes.getNodeAs<CXXConstCastExpr>(
"cast");
25 diag(MatchedCast->getOperatorLoc(),
"do not use const_cast");