ccotter added inline comments.

================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:5503
+                                                          FunctionDecl,
+                                                          CoroutineBodyStmt),
                           internal::Matcher<Stmt>, InnerMatcher) {
----------------
aaron.ballman wrote:
> I'm not certain it makes sense to me to add `CoroutineBodyStmt` to `hasBody` 
> -- in this case, it doesn't *have* a body, it *is* the body.
With respect to `hasBody()`, my intent was to treat the CoroutineBodyStmt node 
as analogous to a FunctionDecl or WhileStmt. WhileStmts have information like 
the loop condition expression, as CoroutineBodyStmts contain the synthesized 
expressions such as the initial suspend Stmt. Both WhileStmts and 
CoroutineBodyStmts then have the `getBody()` methods, usually a CompoundStmt 
for WhileStmts and either a CompoundStmt or TryStmt for CoroutineBodyStmts.

Ultimately, I wanted to be able to match the CoroutineBodyStmt's 
`function-body` (using the grammar) from the standard, e.g., 
`coroutineBodyStmt(hasBody(compoundStmt().bind(...)))`. If there is a different 
approach you'd recommend that's in line with the AST matcher design strategy, I 
can use that instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140794

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to