[cfe-dev] [PATCH] scan-build patch for inter-procedural analysis

Ted Kremenek kremenek at apple.com
Mon Dec 8 10:15:01 PST 2008


On Dec 7, 2008, at 11:15 AM, Zhongxing Xu wrote:

> Add '-mode' option to scan-build. 'intra' mode is the same as  
> before. 'inter' mode makes ccc-analyzer do -serialize on each  
> compile action.
> The patch looks a little messy. But that should be diff's problem.  
> Actually only a few lines are added. No functional change should be  
> incurred.

Hi Zhongxing,

I don't think this is the right approach.  Checks that are inter- 
procedural should just transparently cause "inter-procedural behavior"  
in scan-build.  There is no reason to burden users with this concept  
in the UI.

Also, I think the concept you are thinking about is "whole-program  
analysis", not inter-procedural analysis.  We can do the latter  
without the former, albeit only a translation unit at a time.  Doing  
inter-procedural analysis at the translation unit level seems like a  
more logical starting point to me then adding a fuzzy option to scan- 
build that doesn't do anything.

Moreover, since core pieces needed for whole-program analysis aren't  
in place (e.g., full AST serialization, indexing over a whole-program  
image so we can perform whole-program analysis), it just seems strange  
to add an option to this effect.  We actually don't know yet what the  
whole program image will look like, and it will likely consist of more  
than just serializing out ASTs.

Once we have more of these pieces in place, I think scan-build can  
transparently do whole-program analysis by simply delaying doing  
analysis until after the build completes.  From the user perspective  
this is clean and simple.  There is simply no reason to distinguish  
between "intra" and "inter" modes, at least at this point.

Ted



More information about the cfe-dev mailing list