Warning, /sdk/clazy/README.md is written in an unsupported language. File is not indexed.

0001 clazy v1.11
0002 ===========
0003 
0004 clazy is a compiler plugin which allows clang to understand Qt semantics. You get more than 50 Qt related compiler warnings, ranging from unneeded memory allocations to misusage of API, including fix-its for automatic refactoring.
0005 
0006 Table of contents
0007 =================
0008 
0009    * [Source Code](#source-code)
0010    * [Pre-built binaries](#pre-built-binaries)
0011    * [Build Instructions](#build-instructions)
0012       * [Linux](#linux)
0013          * [Install dependencies](#install-dependencies)
0014          * [Build and install clang](#build-and-install-clang)
0015          * [Build clazy](#build-clazy)
0016       * [Windows](#windows)
0017          * [Build and install clang](#build-and-install-clang-1)
0018          * [Build clazy](#build-clazy-1)
0019       * [macOS with MacPorts](#macos-with-macports)
0020          * [Install clang](#install-clang)
0021          * [Build clazy](#build-clazy-2)
0022       * [macOS with Homebrew](#macos-with-homebrew)
0023          * [Install clang](#install-clang-1)
0024          * [Build clazy](#build-clazy-3)
0025    * [Setting up your project to build with clazy](#setting-up-your-project-to-build-with-clazy)
0026    * [List of checks](#list-of-checks)
0027    * [Selecting which checks to enable](#selecting-which-checks-to-enable)
0028       * [Example via env variable](#example-via-env-variable)
0029       * [Example via compiler argument](#example-via-compiler-argument)
0030    * [clazy-standalone and JSON database support](#clazy-standalone-and-json-database-support)
0031    * [Enabling Fixits](#enabling-fixits)
0032    * [Troubleshooting](#troubleshooting)
0033    * [Qt4 compatibility mode](#qt4-compatibility-mode)
0034    * [Reducing warning noise](#reducing-warning-noise)
0035    * [Reporting bugs and wishes](#reporting-bugs-and-wishes)
0036    * [Authors](#authors)
0037    * [Contributing patches](#contributing-patches)
0038 
0039 # Source Code
0040 
0041 You can get clazy from:
0042 
0043 - <https://github.com/KDE/clazy>
0044 - <https://invent.kde.org/sdk/clazy>
0045 
0046 
0047 # Supported platforms
0048 
0049 Clazy has been tested on Linux, macOS and Windows/MSVC.
0050 Other platforms are not supported but we'll gladly accept patches.
0051 
0052 
0053 # Pre-built binaries
0054 
0055 Pre-built clazy binaries for MSVC and Linux AppImage are produced by KDAB, you can get them from https://downloads.kdab.com/clazy/.
0056 
0057 # Build Instructions
0058 ## Linux
0059 
0060 ### Install dependencies
0061 - OpenSUSE tumbleweed: `zypper install cmake git-core llvm llvm-devel llvm-clang llvm-clang-devel`
0062 - Ubuntu: `apt install g++ cmake clang llvm-dev git-core libclang-dev`
0063 - Archlinux: `pacman -S make llvm clang python2 cmake git gcc`
0064 - Fedora: be sure to *remove* the llvm-static package and only install the one with dynamic libraries
0065 - Other distros: Check llvm/clang build docs.
0066 
0067 ### Build and install clang
0068 clang and LLVM >= 8.0 are required.
0069 
0070 If your distro provides clang then you can skip this step.
0071 
0072 
0073 ```
0074   $ git clone https://github.com/llvm-mirror/llvm.git <some_directory>
0075   $ cd <some_directory>/tools/ && git clone https://github.com/llvm-mirror/clang.git
0076   $ cd <some_directory>/projects && git clone https://github.com/llvm-mirror/compiler-rt.git
0077   $ mkdir <some_directory>/build && cd <some_directory>/build
0078   $ cmake -DCMAKE_INSTALL_PREFIX=<prefix> -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release -G Ninja ..
0079   $ cmake --build .
0080   $ cmake --build . --target install
0081 ```
0082 
0083 ### Build clazy
0084 ```
0085   $ cd clazy/
0086   $ cmake -DCMAKE_INSTALL_PREFIX=<prefix> -DCMAKE_BUILD_TYPE=Release -G Ninja
0087   $ cmake --build .
0088   $ cmake --build . --target install
0089 ```
0090 
0091 See troubleshooting section if you have problems.
0092 
0093 ## Windows
0094 
0095 ### Build and install clang
0096 These instructions assume your terminal is suitable for development.
0097 Ninja (or equivalent), git, cmake, and cl (msvc2019) should be in your PATH.
0098 
0099 clang and LLVM >= 9.0 are required.
0100 
0101 Be sure to pass -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON to CMake when building LLVM, otherwise clazy won't work.
0102 
0103 ```
0104   > git clone https://github.com/llvm/llvm-project.git -b llvmorg-11.0.0 <some_directory>
0105   > mkdir build # Important that this is outside of the source directory
0106   > cd build
0107   > cmake -DCMAKE_INSTALL_PREFIX=c:\my_install_folder\llvm\ -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DCMAKE_BUILD_TYPE=Release -G "Ninja" ../<some_directory>/llvm
0108   > cmake --build .
0109   > cmake --build . --target install
0110   > Add c:\my_install_folder\llvm\bin\ to PATH
0111 ```
0112 
0113 Also be sure to copy the generated `C:\path\to\llvm-build\lib\clang.lib` to your installation folder somewhere. It contains the exported symbols of clang.exe, which the plugins need.
0114 Unfortunately LLVM doesn't install it. You can put it anywhere, just save it so you can delete the build directory.
0115 
0116 ### Build clazy
0117 
0118 Be sure to point CLANG_LIBRARY_IMPORT to clang.lib. It's probably inside your LLVM build dir since it doesn't get installed.
0119 
0120 ```
0121   > cd clazy\
0122   > cmake -DCMAKE_INSTALL_PREFIX=c:\my_install_folder\llvm\ -DCLANG_LIBRARY_IMPORT=C:\path\to\llvm-build\lib\clang.lib -DCMAKE_BUILD_TYPE=Release -G "Ninja"
0123   > cmake --build .
0124   > cmake --build . --target install
0125 ```
0126 
0127 ## macOS with MacPorts
0128 
0129 ### Install clang
0130 ```
0131 $ sudo port install llvm-11 clang-11 cmake ninja coreutils
0132 $ sudo ln -sf /opt/local/bin/llvm-config-mp-11 /opt/local/bin/llvm-config
0133 $ sudo port select --set clang mp-clang-11
0134 ```
0135 
0136 ### Build clazy
0137 ```
0138   $ export CXX=clang++
0139   $ cmake -G Ninja
0140   $ cmake --build .
0141   $ cmake --build . --target install
0142 ```
0143 
0144 ## macOS with Homebrew
0145 
0146 The recommended way is to build clazy yourself, but alternatively you can try user recipes, such as:
0147 
0148 ```
0149 $ brew install kde-mac/kde/clazy
0150 ```
0151 
0152 for stable branch, or for master:
0153 
0154 ```
0155 $ brew install kde-mac/kde/clazy --HEAD
0156 ```
0157 
0158 As these are not verified or tested by the clazy developers please don't report bugs to us.
0159 
0160 For building yourself, read on. You'll have to install clang and build clazy from source.
0161 
0162 ### Install clang
0163 
0164 ```
0165 $ brew install --with-clang llvm
0166 ```
0167 
0168 ### Build clazy
0169 ```
0170   $ export CXX=clang++
0171   $ export LLVM_ROOT=/usr/local/opt/llvm
0172   $ cmake -G Ninja
0173   $ cmake --build .
0174   $ cmake --build . --target install
0175 ```
0176 
0177 # Setting up your project to build with clazy
0178 
0179 Note: Wherever `clazy` is mentioned, replace with `clazy-cl.bat` if you're on Windows, or replace with `Clazy-x86_64.AppImage` if you're using AppImage.
0180 Note: If you prefer running clazy over a JSON compilation database instead of using it as a plugin, jump to [clazy-standalone](#clazy-standalone-and-json-database-support).
0181 
0182 You should now have the clazy command available to you, in `<prefix>/bin/`.
0183 Compile your programs with it instead of clang++/g++.
0184 
0185 Note that this command is just a convenience wrapper which calls:
0186 `clang++ -Xclang -load -Xclang ClazyPlugin.so -Xclang -add-plugin -Xclang clazy`
0187 
0188 If you have multiple versions of clang installed (say clang++-10 and clang++-11)
0189 you can choose which one to use by setting the CLANGXX environment variable, like so:
0190 `export CLANGXX=clang++-11; clazy`
0191 
0192 To build a CMake project use:
0193  `cmake . -DCMAKE_CXX_COMPILER=clazy`
0194 and rebuild.
0195 
0196 To make it the compiler for qmake projects, just run qmake like:
0197 `qmake -spec linux-clang QMAKE_CXX="clazy"`
0198 
0199 On Windows with MSVC it's simply: `qmake QMAKE_CXX="clazy-cl.bat"`
0200 
0201 Alternatively, if you want to use clang directly, without the wrapper:
0202 `qmake -spec linux-clang QMAKE_CXXFLAGS="-Xclang -load -Xclang ClazyPlugin.so -Xclang -add-plugin -Xclang clazy"`
0203 
0204 On Windows it's similar, just inspect the contents of `clazy-cl.bat`.
0205 
0206 
0207 It's recommended that you disable pre-compiled headers and don't use ccache.
0208 
0209 You're all set, clazy will now run some checks on your project, but not all of them.
0210 Read on if you want to enable/disable which checks are run.
0211 
0212 # List of checks
0213 
0214 There are many checks and they are divided in levels:
0215 - level0: Very stable checks, 99.99% safe, mostly no false-positives, very desirable
0216 - level1: The default level. Very similar to level 0, slightly more false-positives but very few.
0217 - level2: Also very few false-positives, but contains noisy checks which not everyone agree should be default.
0218 - manual: Checks here need to be enabled explicitly, as they don't belong to any level. They can be very stable or very unstable.
0219 
0220 clazy runs all checks from level1 by default.
0221 
0222 - Checks from Manual Level:
0223     - [assert-with-side-effects](docs/checks/README-assert-with-side-effects.md)
0224     - [container-inside-loop](docs/checks/README-container-inside-loop.md)
0225     - [detaching-member](docs/checks/README-detaching-member.md)
0226     - [heap-allocated-small-trivial-type](docs/checks/README-heap-allocated-small-trivial-type.md)
0227     - [ifndef-define-typo](docs/checks/README-ifndef-define-typo.md)
0228     - [isempty-vs-count](docs/checks/README-isempty-vs-count.md)
0229     - [jni-signatures](docs/checks/README-jni-signatures.md)
0230     - [qhash-with-char-pointer-key](docs/checks/README-qhash-with-char-pointer-key.md)
0231     - [qproperty-type-mismatch](docs/checks/README-qproperty-type-mismatch.md)
0232     - [qrequiredresult-candidates](docs/checks/README-qrequiredresult-candidates.md)
0233     - [qstring-varargs](docs/checks/README-qstring-varargs.md)
0234     - [qt-keywords](docs/checks/README-qt-keywords.md)    (fix-qt-keywords)
0235     - [qt4-qstring-from-array](docs/checks/README-qt4-qstring-from-array.md)    (fix-qt4-qstring-from-array)
0236     - [qt6-deprecated-api-fixes](docs/checks/README-qt6-deprecated-api-fixes.md)    (fix-qt6-deprecated-api-fixes)
0237     - [qt6-fwd-fixes](docs/checks/README-qt6-fwd-fixes.md)    (fix-qt6-fwd-fixes)
0238     - [qt6-header-fixes](docs/checks/README-qt6-header-fixes.md)    (fix-qt6-header-fixes)
0239     - [qt6-qhash-signature](docs/checks/README-qt6-qhash-signature.md)    (fix-qt6-qhash-signature)
0240     - [qt6-qlatin1stringchar-to-u](docs/checks/README-qt6-qlatin1stringchar-to-u.md)    (fix-qt6-qlatin1stringchar-to-u)
0241     - [qvariant-template-instantiation](docs/checks/README-qvariant-template-instantiation.md)
0242     - [raw-environment-function](docs/checks/README-raw-environment-function.md)
0243     - [reserve-candidates](docs/checks/README-reserve-candidates.md)
0244     - [signal-with-return-value](docs/checks/README-signal-with-return-value.md)
0245     - [thread-with-slots](docs/checks/README-thread-with-slots.md)
0246     - [tr-non-literal](docs/checks/README-tr-non-literal.md)
0247     - [unexpected-flag-enumerator-value](docs/checks/README-unexpected-flag-enumerator-value.md)
0248     - [unneeded-cast](docs/checks/README-unneeded-cast.md)
0249     - [use-arrow-operator-instead-of-data](docs/checks/README-use-arrow-operator-instead-of-data.md)
0250     - [use-chrono-in-qtimer](docs/checks/README-use-chrono-in-qtimer.md)
0251 
0252 - Checks from Level 0:
0253     - [connect-by-name](docs/checks/README-connect-by-name.md)
0254     - [connect-non-signal](docs/checks/README-connect-non-signal.md)
0255     - [connect-not-normalized](docs/checks/README-connect-not-normalized.md)
0256     - [container-anti-pattern](docs/checks/README-container-anti-pattern.md)
0257     - [empty-qstringliteral](docs/checks/README-empty-qstringliteral.md)
0258     - [fully-qualified-moc-types](docs/checks/README-fully-qualified-moc-types.md)
0259     - [lambda-in-connect](docs/checks/README-lambda-in-connect.md)
0260     - [lambda-unique-connection](docs/checks/README-lambda-unique-connection.md)
0261     - [lowercase-qml-type-name](docs/checks/README-lowercase-qml-type-name.md)
0262     - [mutable-container-key](docs/checks/README-mutable-container-key.md)
0263     - [overloaded-signal](docs/checks/README-overloaded-signal.md)
0264     - [qcolor-from-literal](docs/checks/README-qcolor-from-literal.md)
0265     - [qdatetime-utc](docs/checks/README-qdatetime-utc.md)    (fix-qdatetime-utc)
0266     - [qenums](docs/checks/README-qenums.md)
0267     - [qfileinfo-exists](docs/checks/README-qfileinfo-exists.md)
0268     - [qgetenv](docs/checks/README-qgetenv.md)    (fix-qgetenv)
0269     - [qmap-with-pointer-key](docs/checks/README-qmap-with-pointer-key.md)
0270     - [qstring-arg](docs/checks/README-qstring-arg.md)
0271     - [qstring-comparison-to-implicit-char](docs/checks/README-qstring-comparison-to-implicit-char.md)
0272     - [qstring-insensitive-allocation](docs/checks/README-qstring-insensitive-allocation.md)
0273     - [qstring-ref](docs/checks/README-qstring-ref.md)    (fix-missing-qstringref)
0274     - [qt-macros](docs/checks/README-qt-macros.md)
0275     - [strict-iterators](docs/checks/README-strict-iterators.md)
0276     - [temporary-iterator](docs/checks/README-temporary-iterator.md)
0277     - [unused-non-trivial-variable](docs/checks/README-unused-non-trivial-variable.md)
0278     - [use-static-qregularexpression](docs/checks/README-use-static-qregularexpression.md)
0279     - [writing-to-temporary](docs/checks/README-writing-to-temporary.md)
0280     - [wrong-qevent-cast](docs/checks/README-wrong-qevent-cast.md)
0281     - [wrong-qglobalstatic](docs/checks/README-wrong-qglobalstatic.md)
0282 
0283 - Checks from Level 1:
0284     - [auto-unexpected-qstringbuilder](docs/checks/README-auto-unexpected-qstringbuilder.md)    (fix-auto-unexpected-qstringbuilder)
0285     - [child-event-qobject-cast](docs/checks/README-child-event-qobject-cast.md)
0286     - [connect-3arg-lambda](docs/checks/README-connect-3arg-lambda.md)
0287     - [const-signal-or-slot](docs/checks/README-const-signal-or-slot.md)
0288     - [detaching-temporary](docs/checks/README-detaching-temporary.md)
0289     - [foreach](docs/checks/README-foreach.md)
0290     - [incorrect-emit](docs/checks/README-incorrect-emit.md)
0291     - [install-event-filter](docs/checks/README-install-event-filter.md)
0292     - [non-pod-global-static](docs/checks/README-non-pod-global-static.md)
0293     - [overridden-signal](docs/checks/README-overridden-signal.md)
0294     - [post-event](docs/checks/README-post-event.md)
0295     - [qdeleteall](docs/checks/README-qdeleteall.md)
0296     - [qhash-namespace](docs/checks/README-qhash-namespace.md)
0297     - [qlatin1string-non-ascii](docs/checks/README-qlatin1string-non-ascii.md)
0298     - [qproperty-without-notify](docs/checks/README-qproperty-without-notify.md)
0299     - [qstring-left](docs/checks/README-qstring-left.md)
0300     - [range-loop-detach](docs/checks/README-range-loop-detach.md)    (fix-range-loop-add-qasconst)
0301     - [range-loop-reference](docs/checks/README-range-loop-reference.md)    (fix-range-loop-add-ref)
0302     - [returning-data-from-temporary](docs/checks/README-returning-data-from-temporary.md)
0303     - [rule-of-two-soft](docs/checks/README-rule-of-two-soft.md)
0304     - [skipped-base-method](docs/checks/README-skipped-base-method.md)
0305     - [virtual-signal](docs/checks/README-virtual-signal.md)
0306 
0307 - Checks from Level 2:
0308     - [base-class-event](docs/checks/README-base-class-event.md)
0309     - [copyable-polymorphic](docs/checks/README-copyable-polymorphic.md)
0310     - [ctor-missing-parent-argument](docs/checks/README-ctor-missing-parent-argument.md)
0311     - [function-args-by-ref](docs/checks/README-function-args-by-ref.md)    (fix-function-args-by-ref)
0312     - [function-args-by-value](docs/checks/README-function-args-by-value.md)
0313     - [global-const-char-pointer](docs/checks/README-global-const-char-pointer.md)
0314     - [implicit-casts](docs/checks/README-implicit-casts.md)
0315     - [missing-qobject-macro](docs/checks/README-missing-qobject-macro.md)    (fix-missing-qobject-macro)
0316     - [missing-typeinfo](docs/checks/README-missing-typeinfo.md)
0317     - [old-style-connect](docs/checks/README-old-style-connect.md)    (fix-old-style-connect)
0318     - [qstring-allocations](docs/checks/README-qstring-allocations.md)    (fix-qlatin1string-allocations,fix-fromLatin1_fromUtf8-allocations,fix-fromCharPtrAllocations)
0319     - [returning-void-expression](docs/checks/README-returning-void-expression.md)
0320     - [rule-of-three](docs/checks/README-rule-of-three.md)
0321     - [static-pmf](docs/checks/README-static-pmf.md)
0322     - [virtual-call-ctor](docs/checks/README-virtual-call-ctor.md)
0323 
0324 # Selecting which checks to enable
0325 
0326 You may want to choose which checks to enable before starting to compile.
0327 If you don't specify anything then all checks from level0 and level1 will run.
0328 To specify a list of checks to run, or to choose a level, you can use the `CLAZY_CHECKS` env variable or pass arguments to the compiler.
0329 You can disable checks by prefixing with `no-`, in case you don't want all checks from a given level.
0330 
0331 ## Example via env variable
0332 ```
0333 export CLAZY_CHECKS="unneeded-cast,qmap-with-pointer-key,virtual-call-ctor" # Enables only these 3 checks
0334 export CLAZY_CHECKS="level0,no-qenums" # Enables all checks from level0, except for qenums
0335 export CLAZY_CHECKS="level0,detaching-temporary" # Enables all from level0 and also detaching-temporary
0336 ```
0337 ## Example via compiler argument
0338 `clazy -Xclang -plugin-arg-clazy -Xclang level0,detaching-temporary`
0339 Don't forget to re-run cmake/qmake/etc if you altered the c++ flags to specify flags.
0340 
0341 # clazy-standalone and JSON database support
0342 
0343 The `clazy-standalone` binary allows you to run clazy over a compilation database JSON file, in the same
0344 way you would use `clang-tidy` or other clang tooling. This way you don't need to build your application,
0345 only the static analysis is performed.
0346 
0347 Note: If you're using the AppImage, use `Clazy-x86_64.AppImage --standalone` instead of `clazy-standalone`.
0348 
0349 `clazy-standalone` supports the same env variables as the clazy plugin. You can also specify a list of checks via
0350 the `-checks` argument.
0351 
0352 
0353 Running on one cpp file:
0354 `clazy-standalone -checks=install-event-filter,qmap-with-pointer-key,level0 -p compile_commands.json my.file.cpp`
0355 
0356 Running on all cpp files:
0357 `find . -name "*cpp" | xargs clazy-standalone -checks=level2 -p default/compile_commands.json`
0358 
0359 See https://clang.llvm.org/docs/JSONCompilationDatabase.html for how to generate the compile_commands.json file. Basically it's generated
0360 by passing `-DCMAKE_EXPORT_COMPILE_COMMANDS` to CMake, or using [Bear](https://github.com/rizsotto/Bear) to intercept compiler commands, or, if you're using `qbs`:
0361 
0362 `qbs generate --generator clangdb`
0363 
0364 **Note:** Be sure the clazy-standalone binary is located in the same folder as the clang binary, otherwise it will have trouble
0365 finding builtin headers, like stddef.h. Alternatively, you can symlink to the folder containing the builtin headers:
0366 
0367 (Assuming clazy was built with `-DCMAKE_INSTALL_PREFIX=/myprefix/`)
0368 
0369 ```
0370 $ touch foo.c && clang++ '-###' -c foo.c 2>&1 | tr ' ' '\n' | grep -A1 resource # Make sure this clang here is not Apple clang. Use for example clang++-mp-8.0 if on macOS and haven't run `port select` yet.
0371   "-resource-dir"
0372   "/opt/local/libexec/llvm-8.0/lib/clang/8.0.1" # The interesting part is /opt/local/libexec/llvm-8.0
0373 $ ln -sf /opt/local/libexec/llvm-8.0/lib/clang/ /myprefix/lib/clang
0374 $ mkdir /myprefix/include/
0375 $ ln -sf /opt/local/libexec/llvm-8.0/include/c++/ /myprefix/include/c++ # Required on macOS
0376 ```
0377 
0378 If that doesn't work, run `clang -v` and check what's the InstalledDir. Move clazy-standalone to that folder.
0379 
0380 `clang-tidy` support will be added after <https://bugs.llvm.org//show_bug.cgi?id=32739> is fixed.
0381 
0382 # Enabling Fixits
0383 
0384 Some checks support fixits, in which clazy will help re-write your source files whenever it can fix something.
0385 Simply pass `-Xclang -plugin-arg-clazy -Xclang export-fixes` to clang, or `-export-fixes=somefile.yaml` for `clazy-standalone`.
0386 Alternatively, set the `CLAZY_EXPORT_FIXES` env variable (works only with the plugin, not with standalone).
0387 Then run `clang-apply-replacements <folder_with_yaml_files>`, which will modify your code.
0388 
0389 When using fixits, prefer to run only a single check each time, so they don't conflict
0390 with each other modifying the same source lines.
0391 
0392 **WARNING**: Backup your code and make sure all changes done by clazy are correct.
0393 
0394 # Troubleshooting
0395 
0396 - clang: symbol lookup error: `/usr/lib/x86_64-linux-gnu/ClazyPlugin.so: undefined symbol: _ZNK5clang15DeclarationName11getAsStringEv`.
0397   This is due to mixing ABIs. Your clang/llvm was compiled with the [new gcc c++ ABI][1] but you compiled the clazy plugin with clang (which uses [the old ABI][2]).
0398 
0399   The solution is to build the clazy plugin with gcc or use a distro which hasn't migrated to gcc5 ABI yet, such as archlinux.
0400 
0401 [1]: https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
0402 [2]: https://llvm.org/bugs/show_bug.cgi?id=23529
0403 
0404 - [Fedora] cmake can't find LLVM ?
0405   Try building llvm/clang yourself
0406   (There are reports that /usr/share/llvm/cmake/LLVM-Config.cmake is buggy).
0407 
0408 - [Fedora] CommandLine Error: `Option 'opt-bisect-limit' registered more than once!`
0409   Remove the llvm-static package and use the dynamically linked libraries instead.
0410   Alternatively, if you want to use llvm-static, see next item.
0411 
0412 - CommandLine Error: `Option 'foo' registered more than once!`
0413   Means you're building against a static version of LLVM (*.a files instead of *.so).
0414   Try passing to cmake -DLINK_CLAZY_TO_LLVM=OFF when building clazy, this was tested
0415   successfully against a static LLVM 7.0, and might work with other versions.
0416 
0417 - Some checks are mysteriously not producing warnings or not applying fixits ?
0418   Check if you have ccache interfering and turn it off.
0419 
0420 - fatal error: 'stddef.h' file not found, while using `clazy-standalone`
0421   Be sure the clazy-standalone binary is located in the same folder as the clang binary.
0422 
0423 - Be sure to disable pch.
0424 
0425 - macOS: Be sure you're not using Apple Clang
0426 
0427 - macOS: System Integrity Protection blocks the use of DYLD_LIBRARY_PATH. With SIP enabled you need to pass the full path
0428   to ClazyPlugin.dylib, otherwise you'll get `image not found` error.
0429 
0430 - Windows: fatal error LNK1112: module machine type ‘X86’ conflicts with target machine type ‘x64’
0431   If you're building in 32-bit, open clazy-cl.bat and insert a -m32 argument.
0432   Should read: %~dp0\clang\clang.exe –driver-mode=cl -m32 (...)
0433 
0434 # Qt4 compatibility mode
0435 
0436 When running on codebases that must still compile with Qt4, you can pass `--qt4compat`
0437 (a convenience option equivalent to passing `-Xclang -plugin-arg-clazy -Xclang qt4-compat`)
0438 to disable checks that only make sense with Qt5.
0439 
0440 For example, to build a CMake project with Qt4 compatibility use:
0441  `CXX="clazy --qt4compat"; cmake .`
0442 and rebuild.
0443 
0444 # Reducing warning noise
0445 
0446 If you think you found a false-positive, file a bug report. But do make sure to test first without icecc/distcc enabled.
0447 
0448 If you want to suppress warnings from headers of Qt or 3rd party code, include them with `-isystem` instead of `-I` (gcc/clang only).
0449 For MSVC use `/external`, which is available since VS 15.6.
0450 
0451 Alternatively you can set the CLAZY_HEADER_FILTER env variable to a regexp matching the path where you want warnings,
0452 for example `CLAZY_HEADER_FILTER=.*myapplication.*`.
0453 
0454 You can also exclude paths using a regexp by setting CLAZY_IGNORE_DIRS, for example `CLAZY_IGNORE_DIRS=.*my_qt_folder.*`.
0455 
0456 You can also suppress individual warnings by file or by line by inserting comments:
0457 
0458 - To disable clazy in a specific source file, insert this comment, anywhere in the file:
0459 `// clazy:skip`
0460 
0461 - To disable specific checks in a source file, insert a comment such as
0462 `// clazy:excludeall=check1,check2`
0463 
0464 - To disable specific checks in specific source lines, insert a comment in the same line as the warning:
0465 `(...) // clazy:exclude=check1,check2`
0466 
0467 Don't include the `clazy-` prefix. If, for example, you want to disable qstring-allocations you would write:
0468 `// clazy:exclude=qstring-allocations` not `clazy-qstring-allocations`.
0469 
0470 # Reporting bugs and wishes
0471 
0472 - bug tracker: <https://bugs.kde.org/enter_bug.cgi?product=clazy>
0473 - IRC: #kde-clazy (irc.libera.chat)
0474 - E-mail: <smartins at kde.org>
0475 
0476 When reporting a bug *please* include a minimal compilable testcase. No matter
0477 how simple it is, it saves me time from deciphering a bug report. Time spent
0478 doing triaging is time not spent writing fixes.
0479 
0480 A minimal testcase is also something I can copy to the test suite.
0481 
0482 Make sure you can reproduce with clazy (outside of QtCreator), otherwise it can be a QtCreator bug instead,
0483 which you can report at <https://bugreports.qt.io/>.
0484 
0485 
0486 # Authors
0487 
0488 - Sérgio Martins
0489 
0490 with contributions from:
0491 
0492 - Allen Winter
0493 - Kevin Funk
0494 - Mathias Hasselmann
0495 - Laurent Montel
0496 - Albert Astals Cid
0497 - Aurélien Gâteau
0498 - Hannah von Reth
0499 - Volker Krause
0500 - Christian Ehrlicher
0501 - Christian Gagneraud
0502 - Nikolai Kosjar
0503 - Jesper K. Pedersen
0504 - Lucie Gerard
0505 - Christian Schärf
0506 - Waqar Ahmed
0507 
0508 qt6-* porting checks written by Lucie Gerard <lucie.gerard@qt.io>
0509 
0510 and thanks to:
0511 
0512 - Klarälvdalens Datakonsult AB (<http://www.kdab.com>), for letting me work on clazy as a research project
0513 
0514 
0515 # Contributing patches
0516 
0517 New features go to master and bug fixes go to the 1.11 branch.
0518 The prefered way to contributing is by using KDE's GitLab instance,
0519 see <https://community.kde.org/Infrastructure/GitLab>.
0520 
0521 If you rather just create a pull request in https://github.com/KDE/clazy for a drive-by change, it's also fine, but beware that
0522 the maintainer might forget to check on github and the KDE bot will close the PR. In that case just send a reminder to the maintainer (smartins at kde.org).