17 return Node.isConstantInitializer(Finder->getASTContext(),
false);
21 return Node.getStorageDuration() == SD_Static && !Node.isLocalVarDecl();
35 hasDescendant(cxxConstructExpr(unless(allOf(
37 hasDeclaration(cxxConstructorDecl(isConstexpr())),
39 isConstantInitializer())))))
45 const MatchFinder::MatchResult &Result) {
46 if (
const auto *D = Result.Nodes.getNodeAs<VarDecl>(
"decl"))
47 diag(D->getBeginLoc(),
"static objects are disallowed; if possible, use a "
48 "constexpr constructor instead");
void registerMatchers(ast_matchers::MatchFinder *Finder) override
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
AST_MATCHER(BinaryOperator, isRelationalOperator)