[PATCH] D76196: [ASTMatchers] Extend hasReturnValue to GNU StmtExpr

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 15 17:42:36 PDT 2020


njames93 added a comment.

In D76196#1923524 <https://reviews.llvm.org/D76196#1923524>, @aaron.ballman wrote:

> I don't think this is a natural fit for the functionality. A statement expression doesn't have a return value so much as it is a value expression that can contain multiple statements. To me, at least, this is a bit like saying the comma operator has a return value because you can do `int i; i = 1, 2, 3;` and it "returns" 3.
>
> Can you explain a bit about why you need this matcher functionality?


I wasn't sure where to best place this and I was well aware of the comma operator acting similarly. The idea behind it is the first `N-1` statements in a `StmtExpr` with `N` aren't as relevant as the final `Stmt` if its an `Expr` Maybe hasFinalExpression(InnerMatcher<Expr>) would be a better way WDYT?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76196/new/

https://reviews.llvm.org/D76196





More information about the cfe-commits mailing list