20 return Node.isConstantInitializer(Finder->getASTContext(),
false);
24 return Node.getStorageDuration() == SD_Static && !Node.isLocalVarDecl();
28 void StaticallyConstructedObjectsCheck::registerMatchers(MatchFinder *Finder) {
34 if (!getLangOpts().CPlusPlus11)
37 Finder->addMatcher(varDecl(
41 hasDescendant(cxxConstructExpr(unless(allOf(
43 hasDeclaration(cxxConstructorDecl(isConstexpr())),
45 isConstantInitializer())))))
50 void StaticallyConstructedObjectsCheck::check(
51 const MatchFinder::MatchResult &
Result) {
52 if (
const auto *
D = Result.Nodes.getNodeAs<VarDecl>(
"decl"))
53 diag(
D->getBeginLoc(),
"static objects are disallowed; if possible, use a " 54 "constexpr constructor instead");
AST_MATCHER(BinaryOperator, isAssignmentOperator)
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//