11 #include "clang/AST/ASTContext.h" 12 #include "clang/ASTMatchers/ASTMatchFinder.h" 18 namespace cppcoreguidelines {
20 void ProTypeReinterpretCastCheck::registerMatchers(MatchFinder *Finder) {
21 if (!getLangOpts().CPlusPlus)
24 Finder->addMatcher(cxxReinterpretCastExpr().bind(
"cast"),
this);
27 void ProTypeReinterpretCastCheck::check(
28 const MatchFinder::MatchResult &
Result) {
29 const auto *MatchedCast =
30 Result.Nodes.getNodeAs<CXXReinterpretCastExpr>(
"cast");
31 diag(MatchedCast->getOperatorLoc(),
"do not use reinterpret_cast");
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//