[cfe-dev] [StaticAnalyzer] What is the right callback for analyzing IfStmt ?

Jordan Rose jordan_rose at apple.com
Mon Nov 4 09:41:54 PST 2013


Hi, Mats. You're right that there's currently not a pre-statement check for "if". However, the different.IdenticalCondIfElseIf checker probably does not need to use path-sensitive checks. Instead, you can use a syntactic check that simply walks the AST for a function body.

Actually, you should probably talk to Per Viberg, whose IdenticalExprChecker (identical expressions on both sides of a logical operator) is set to land soon. (Per, I'm going to check the results from LLVM/Clang today.) I imagine you'd be able to get a lot of reuse out of his code.

Jordan


On Nov 3, 2013, at 4:02 , Mats Taraldsvik <mats.taraldsvik at gmail.com> wrote:

> Hi,
> 
> I am hoping to be able to develop (and contribute) a checker from the "potential future checkers" at clang-analyzer.llvm.org. Currently, I have created a checker and successfully registered it with the analyzer, but it currently does nothing.
> 
> I have looked at the "potential future checkers" list, and thought the different.IdenticalCondIfElseIf item could be an easy checker to implement for a beginner (If I'm wrong, perhaps you could point me towards a checker that is easy to implement).
> 
> However, I don't know what callback to use, since checkPreStmt and checkPostStmt does not include control flow statements, and the checkBranchCondition only checks each branch condition.
> 
> I would need to examine the entire if-branch (if condition x every else if condition), to be able to detect identical branch conditions, right?
> 
> Regards,
> Mats Taraldsvik
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list