Using Clang Static Analyzer in Eclipse CDT - c++

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.

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

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

You can take a look at Artemis plugin. Open source project with real-time check based on CODAN framework and quickfix support.

Related

Running PMD for C++ project in eclipse

I am using eclipse based development IDE called STM32Cube IDE V1.5.1. I have installed PMD plugin into same. PMD Plugin version 4.24.x & PMD Version 6.35.x.
On most of the links it was found that PMD can be used for java projects for code analysis however I could not find any information whether it can be used for C++ project or not.
If it can be used for C++ project can anyone direct me to the link.
or can anyone pass on the information on how to configure PMD tool for code analysis for C++ project.
Best Regards,
Satish
PMD doesn't support C++ (or C) for static code analysis. You can only search for duplicated code (the tool "CPD") which is also included in PMD.
CPD: https://pmd.github.io/latest/pmd_userdocs_cpd.html
This tool can be run from within eclipse (with the Eclipse PMD Plugin installed) via the menu "Find suspect cut and paste...".
For the full supported languages of PMD see https://pmd.github.io/latest/pmd_userdocs_cli_reference.html#supported-languages

How to setup Eclipse CDT to use clang compiler? [duplicate]

Is it possible to use Clang/LLVM with Eclipse CDT and if so, how is it configured to actually make it work?
I am the main author of the (only) LLVM plug-in for Eclipse CDT. It is still in development so might not be suitable for production environment yet. However feel free to test it to find out if it is suitable for your needs.
https://github.com/TuononenP/llvm4eclipsecdt
UPDATE
The latest version is available via official Eclipse update site: http://download.eclipse.org/releases/mars
It is under Programming Languages and is named "C/C++ LLVM-Family Compiler Build Support".
Here is the LLVM plugin for CDT http://code.google.com/p/llvm4eclipsecdt/
And here ↑↑↑↑ is its author, Petri Tuononen. Thank you, Petri!

Eclipse CDT documentation on C++ autocomplete

I was trying to set up my development environment on Eclipse CDT for C++ and although the auto-complete is working (it finds classes like vector and such) it shows no documentation on C++ stuff, only C stuff (fopen, fclose, malloc) has documentation appearing on the auto-complete.
Some notes:
I'm using Linux Mint and Eclipse Kepler Service Release 1 Build id: 20130919-0819
I had to manually install g++ on my Linux. I used 'sudo apt-get install g++-4.7' to install it
I had to manually place "/usr/include/c++/4.7.3/" on the GCC C++ Compiler Includes in the Tool Settings in the project properties to get it to compile.
Any ideas on how to get the documentation in there?
The help on C is provided by Libhover plugin. The developers tried to support C++ but seems these efforts did not get much traction.
C++ hover is actually installed by default in CDT. If not, you can install it manually (at CDT site look for "Plugins for C/C++ library hover help." and "Plugins for creating hover help from installed C devhelp documentation").
However, it is not enough. To get hovering help similar to C documentation you have to generate Doxygen XML for your library, e.g. for STL. Details are provided in hover documentation

using codelite with scons

How difficult is to use codelite on top of a scons project?
what features i should expect to lose? is there a way to configure codelite to use the scons configuration files to keep track of the project files.
At the moment i'm using Netbeans 7.1, but the tool doesn't scale well with complex projects like LLVM. I'm curious with codelite as it seems to have a very good code completion architecture (relying on the llvm clang plugin) but i'm not sure how hard will it be to migrate my project (based on scons) to it
I dont know anything about codelite, but eclipse is an excellent IDE with code completion like you mention. There is an SCons plugin available for eclipse called SConsolidator.
I have found that eclipse has excellent support for C++ and Python.
Why not?
But codelite is old-school IDE with very poor functional, like Visual Studio 6. I recommend use Eclipse CDT.

How to use clang/llvm with Eclipse CDT

Is it possible to use Clang/LLVM with Eclipse CDT and if so, how is it configured to actually make it work?
I am the main author of the (only) LLVM plug-in for Eclipse CDT. It is still in development so might not be suitable for production environment yet. However feel free to test it to find out if it is suitable for your needs.
https://github.com/TuononenP/llvm4eclipsecdt
UPDATE
The latest version is available via official Eclipse update site: http://download.eclipse.org/releases/mars
It is under Programming Languages and is named "C/C++ LLVM-Family Compiler Build Support".
Here is the LLVM plugin for CDT http://code.google.com/p/llvm4eclipsecdt/
And here ↑↑↑↑ is its author, Petri Tuononen. Thank you, Petri!