19 const VariadicDynCastAllOfMatcher<Stmt, AttributedStmt> AttributedStmt;
23 const auto ExprStmt = [&](
const Matcher<Expr> &InnerMatcher) {
24 return expr(hasParent(stmt(anyOf(doStmt(), whileStmt(), forStmt(),
25 compoundStmt(), ifStmt(), switchStmt(),
26 labelStmt(), AttributedStmt()))),
32 cxxConstructExpr(hasType(cxxRecordDecl(anyOf(
33 matchesName(
"[Ee]xception|EXCEPTION"),
34 hasAnyBase(hasType(hasCanonicalType(recordType(hasDeclaration(
35 cxxRecordDecl(matchesName(
"[Ee]xception|EXCEPTION"))
36 .bind(
"base")))))))))))
37 .bind(
"temporary-exception-not-thrown"),
42 const auto *TemporaryExpr =
43 Result.Nodes.getNodeAs<Expr>(
"temporary-exception-not-thrown");
45 diag(TemporaryExpr->getBeginLoc(),
"suspicious exception object created but "
46 "not thrown; did you mean 'throw %0'?")
47 << TemporaryExpr->getType().getBaseTypeIdentifier()->getName();
49 if (
const auto *BaseDecl = Result.Nodes.getNodeAs<Decl>(
"base"))
50 diag(BaseDecl->getLocation(),
51 "object type inherits from base class declared here",