[cfe-dev] Moving AnalysisConsumer.h/cpp out of tools/clang-cc

Ted Kremenek kremenek at apple.com
Tue May 19 07:13:01 PDT 2009


On May 19, 2009, at 3:38 AM, Eli Friedman wrote:

> I've just finished some work with the command-line options for
> AnalysisConsumer, so that it's a possibility to move the header into
> include/clang/ and the corresponding .cpp file into lib/.  Is there
> anything else I should change before moving it?  Also, I'm not sure
> where to move it; would include/clang/Frontend or
> include/clang/Analysis be more appropriate?  (I'm thinking Frontend is
> more appropriate, but I'm not sure.)
>
> -Eli

I think it is fine to move it to lib/Frontend.

To be honest, I'm not 100% certain what removing the command line  
options logic from AnalysisConsumer.cpp buys us, although I do  
understand the motivation of having clang-cc.cpp responsible for the  
command line options and libFrontend responsible for the logic.   
Still, this separation makes it more cumbersome to add new analysis- 
specific command-line options.

Originally all of the analysis-specific options were in clang-cc.cpp  
(then clang.cpp), with the necessary flags passed as function  
arguments to CreateAnalysisConsumer.  While this created a "clean"  
separation of concerns from the options-processing point of view, it  
meant that every time a new option was added 2-3 files had to get  
modified.  This kind of sucked, which is why I got lazy and stopped  
doing it, but I admit I wasn't doing things as intelligently as I could.

Anyway, I still think moving AnalysisConsumer.cpp to libFrontend is  
the right thing to do.

Thanks for tackling this Eli.

Ted



More information about the cfe-dev mailing list