10 #include "clang/AST/ASTContext.h" 11 #include "clang/ASTMatchers/ASTMatchFinder.h" 17 namespace cppcoreguidelines {
19 void ProTypeUnionAccessCheck::registerMatchers(MatchFinder *Finder) {
20 if (!getLangOpts().CPlusPlus)
24 memberExpr(hasObjectExpression(hasType(recordDecl(isUnion()))))
29 void ProTypeUnionAccessCheck::check(
const MatchFinder::MatchResult &Result) {
30 const auto *Matched = Result.Nodes.getNodeAs<MemberExpr>(
"expr");
31 diag(Matched->getMemberLoc(),
32 "do not access members of unions; use (boost::)variant instead");
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//