[PATCH] D21243: Fix clang-tidy patterns to adapt to newly added ExprWithCleanups nodes.

Tim Shen via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 13 11:32:27 PDT 2016


timshen added a comment.

In http://reviews.llvm.org/D21243#455999, @alexfh wrote:

> Does this just fix the tests broken with http://reviews.llvm.org/D20498 or have you looked at other checks that might be broken by http://reviews.llvm.org/D20498, but don't have relevant tests?


This just fixes the tests broken by http://reviews.llvm.org/D20498. I didn't look at other patterns.

> Actually, the more interesting question is what patterns in the analyzed code generate `ExprWithCleanups`?


A MaterializeTemporaryExpr now will always generate an ExprWithCleanups at full-expr entry. That is to say, there must be an ExprWithCleanups as an ancestor node of a MaterializeTemporaryExpr.

For example, the previous pattern:

  fooStmt(has(
    barExpr(
      hasDescendant(
        materializeTemporaryExpr()))))

should be changed to:

  fooStmt(has(
    exprWithCleanups(
      barExpr(
        hasDescendant(
          materializeTemporaryExpr())))

There are patterns around that are not explicitly checking for a MaterializeTemporaryExpr. If in the checked AST there is a MaterializeTemporaryExpr, an ignoringExprWithCleanups should be added to each of these patterns.

Does this help?


http://reviews.llvm.org/D21243





More information about the cfe-commits mailing list