Qt oriented code checker based on clang framework. Krazy's little brother.
License
nimxor/clazy
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
-------------------------------------------------------------------------------- BUILD INSTRUCTIONS * Install needed dependencies: OpenSUSE tumbleweed: zypper install cmake git-core llvm llvm-devel llvm-clang llvm-clang-devel Ubuntu-15.10: apt-get install g++ cmake clang llvm git-core libclang-3.6-dev Archlinux: pacman -S make llvm clang python2 cmake qt5-base git gcc * Build and install clang >= 3.6 if your distro doesn't provide it $ git clone https://github.com/llvm-mirror/llvm.git <some_directory> $ mkdir <some_directory>/build && cd <some_directory>/build $ ../configure --enable-optimized --prefix=<prefix> && make && make install * Build the clang-lazy plugin $ cmake -DCMAKE_INSTALL_PREFIX=<prefix> -DCMAKE_BUILD_TYPE=Release $ make && make install -------------------------------------------------------------------------------- USAGE INSTRUCTIONS You should now have the clazy command available to you, in <prefix>/bin/. Compile your programs with it instead of clang++/g++. Note that this command is just a convenience wrapper which calls: clang++ -Xclang -load -Xclang ClangLazy.so -Xclang -add-plugin -Xclang clang-lazy To make it the default compiler for cmake projects just: export CXX="clazy" Don't forget to clean and re-run cmake To make it the default compiler for qmake projects hack the mkspec: Edit mkspecs/common/clang.conf and change QMAKE_CXX to clazy instead of clang++ Then run qmake -spec linux-clang Finally, you need to choose which checks to enable. This is done through CLAZY_CHECKS env variable, for example: export CLAZY_CHECKS="bogus-dynamic-cast,qmap-with-key-pointer,virtual-call-ctor" or to enable all checks export CLAZY_CHECKS=all_checks Instead of using the env variable, you can also pass an argument to the compiler: -Xclang -plugin-arg-clang-lazy -Xclang bogus-dynamic-cast,qmap-with-key-pointer,virtual-call-ctor Available checks: bogus-dynamic-cast foreacher global-const-char-pointer inefficient-qlist qstring-uneeded-heap-allocations (fix-qlatin1string-allocations,fix-fromLatin1_fromUtf8-allocations,fix-fromCharPtrAllocations) qstring-arg qstring-ref (fix-missing-qstringref) function-args-by-ref qmap-with-key-pointer non-pod-global-static reserve-candidates variant-sanitizer virtual-call-ctor missing-typeinfo implicit-casts old-style-connect (fix-old-style-connects) detaching-temporary assert-with-side-effects qgetenv -------------------------------------------------------------------------------- ENABLING FIXITS Some checks support fixits, in which clazy will re-write your source files whenever it can fix something. You can enable a fixit through the env variable, for example: export CLAZY_FIXIT="fix-qlatin1string-allocations" Only one fixit can be enabled each time. WARNING: Backup your code, don't blame me if a fixit is not applied correctly. For better results don't use parallel builds, otherwise a fixit being applied in an header file might be done twice. --------------------------------------------------------------------------------
About
Qt oriented code checker based on clang framework. Krazy's little brother.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- C++ 95.9%
- CMake 2.3%
- Python 1.7%
- Shell 0.1%