10#include "clang/AST/ASTContext.h"
11#include "clang/ASTMatchers/ASTMatchFinder.h"
19 memberExpr(hasObjectExpression(hasType(recordDecl(isUnion()))))
25 const auto *Matched = Result.Nodes.getNodeAs<MemberExpr>(
"expr");
26 diag(Matched->getMemberLoc(),
27 "do not access members of unions; use (boost::)variant instead");
DiagnosticBuilder diag(SourceLocation Loc, StringRef Description, DiagnosticIDs::Level Level=DiagnosticIDs::Warning)
Add a diagnostic with the check's name.
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.