[cfe-dev] Clang static analyzer

Artem Dergachev via cfe-dev cfe-dev at lists.llvm.org
Fri May 29 05:13:27 PDT 2020


I never tried this but what you're doing is clearly not sufficient. 
SetUpStaticAnalyzer only asks the preprocessor to act as if the static 
analyzer is eventually going to be run.

You should start with making sure your action is AnalysisAction. You can 
probably use clang-check as an example.

On 5/28/20 8:53 PM, Billy Araujo via cfe-dev wrote:
> Hi All,
>
> In my clang tool I setup the static analyzer using the following code:
> But I am not sure if this is sufficient. I don't see any analyzer 
> messages in the output. Is there any way to test if it is active?
>
>
> bool runInvocation(std::shared_ptr<clang::CompilerInvocation> 
> invocation, clang::FileManager* files, 
> std::shared_ptr<clang::PCHContainerOperations> PCHContainerOps, 
> clang::DiagnosticConsumer* diagConsumer) override
> {
> invocation->getPreprocessorOpts().SetUpStaticAnalyzer = true;
> return 
> clang::tooling::FrontendActionFactory::runInvocation(invocation, 
> files, PCHContainerOps, diagConsumer);
> }
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list