Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Clang Static Analyzer in Eclipse CDT

Although it is theoretically possible to integrate an external static analyzer into Eclipse as demonstrated here (i.e. for Cppcheck), I was wondering whether a more up to date solution exists which does not require plug-in development? For example an existing plug-in, an available option in CODAN or a simplified version of the above tutorial for Clang Static Analyzer specifically.

like image 844
Teodor Nikolov Avatar asked Jan 06 '23 15:01

Teodor Nikolov


2 Answers

CodeCheckerEclipsePlugin is an Eclipse plugin that shows Clang Static Analyzer and Clang Tidy defects for your C/C++ projects.

After installation you can add it to your CDT project as "CodeChecker nature". The only software requirement is that you must have Clang and CodeChecker tools installed on your machine. You will need to set up your project so it builds from from Eclipse CDT. Clang static analyzer will be called automatically on your code whenever you build your project in eclipse.

The plugin will call the CodeChecker tool in the background which in turn calls the analysis engines (tidy and static-analyzer) on your build.

As an extention to ClangSA, you may also suppress false positives by using codechecker_suppress code comments like: // codechecker_suppress [deadcode.DeadStores] suppress deadcode

The plugin is hosted on github, see https://github.com/Ericsson/CodeCheckerEclipsePlugin

like image 77
Dániel Krupp Avatar answered Jan 11 '23 03:01

Dániel Krupp


No. But possible? Yes. All it takes is volunteers to make it happen.

like image 30
Doug Schaefer Avatar answered Jan 11 '23 01:01

Doug Schaefer