[AST Matchers] Ordering in compound statements

I’m writing a tool that should remove code after markers that have been found to be dead.
The goal is to leave the control flow and declarations following the marker intact while removing everything else.

Is there a way to only match statements in a compound statement that appear after a certain statement (that I can match without problems), but not before? Or are there alternatives to the matcher system that I could use here?

We don’t have anything directly supported in the AST matchers. There was a somewhat recent review related to this (⚙ D116518 [ast-matchers] Add hasSubstatementSequence matcher) and it has some potential ideas in the comments that may help you out.