[cfe-dev] Getting the body of if loop using AstMatcher

Aaron Ballman via cfe-dev cfe-dev at lists.llvm.org
Thu Nov 17 07:54:17 PST 2016


On Thu, Nov 17, 2016 at 10:51 AM, John Tan via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
> I am currently stumped on how to get / copy the body of a if loop out. Any
> help would be appreciated.

The hasThen() matcher lets you match on the true branch of an if
statement, while the hasElse() matcher lets you match on the false
branch, so perhaps something like
ifStmt(hasThen(what_you_are_interested_in())) is what you're looking
for.

~Aaron

>
>
> Much Thanks,
>
> John Tan
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>



More information about the cfe-dev mailing list