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

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