[cfe-dev] check whether a `case` statement has a `break` statement?

kevinlynx kevinlynx at gmail.com
Tue Jan 1 06:30:01 PST 2013


In my parser, I get a `SwitchStmt`, and I can traverse all `case` statements of it. I want to check whether a `case` statement has a `break` statement. But i can not figure it out. Here is my codes:

    for (SwitchCase *c = stmt->getSwitchCaseList(); c != NULL; c = c->getNextSwitchCase()) {
            if (isa<CaseStmt>(c)) {
                CaseStmt *caseStmt = cast<CaseStmt>(c)
                // I do not know how to check `CaseStmt` has a `BreakStmt`
            }
    }

Thanks.

BTW, I'm writing a static c code analyzer recently, this tool will check a number of c coding style rules for c codes. And because I'm a newbie to clang, so there will be more newbie questions coming, i'm sorry if i bother you guys.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130101/83023f14/attachment.html>


More information about the cfe-dev mailing list