Re: How to determine the corresponding block of a statement?
Something like this could work:
If you have a Stmt * that corresponds to the return statement in your example, you can use the `getParents()` method from `ASTContext` to get the list of its parents. Then you can check whether the `if` has a body with braces by iterating over the parents until you find the `if`, and checking if the `if`s body is a CompoundStmt.
On 31 July 2017 at 15:49, Marcel Schaible via cfe-dev <[hidden email]> wrote:
what is the proper way to determine the surrounding block/scope
of a statement?
I want to insert in each branch some diagnostic code like e.g.