aaron.ballman added a comment. In D76196#1923597 <https://reviews.llvm.org/D76196#1923597>, @njames93 wrote:
> 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? I'm still not understanding your use case, so it's a bit hard for me to tell whether this approach is good or not. Do you have a situation where you cannot match on the expression itself, you also have to know its position? I'm asking because we don't currently have support for querying positional statements (for instance, you cannot ask what the final statement in a `CompoundStmt`) and statement expressions are a bit strange. For instance, what would the final "expression" be in this legal-but-bizarre statement expression: `({int j = 12; j; int x;});`? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76196/new/ https://reviews.llvm.org/D76196 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits