{"id":13419208,"url":"https://github.com/KDE/clazy","last_synced_at":"2025-03-15T05:30:28.685Z","repository":{"id":38359934,"uuid":"42734830","full_name":"KDE/clazy","owner":"KDE","description":"Qt-oriented static code analyzer based on the Clang framework","archived":false,"fork":false,"pushed_at":"2024-09-13T11:09:50.000Z","size":4182,"stargazers_count":662,"open_issues_count":0,"forks_count":92,"subscribers_count":38,"default_branch":"master","last_synced_at":"2024-09-14T01:02:01.100Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://invent.kde.org/sdk/clazy","language":"C++","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KDE.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog","contributing":null,"funding":null,"license":"LICENSES/BSD-2-Clause.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-18T16:48:48.000Z","updated_at":"2024-09-11T16:50:09.000Z","dependencies_parsed_at":"2023-12-20T23:51:25.568Z","dependency_job_id":"c3fa54f3-05a2-4cae-b85c-3a044c371f16","html_url":"https://github.com/KDE/clazy","commit_stats":{"total_commits":2328,"total_committers":84,"mean_commits":"27.714285714285715","dds":"0.28436426116838487","last_synced_commit":"6a588d108b7a6e1b4557d32d412b208a58ce77e5"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KDE%2Fclazy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KDE%2Fclazy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KDE%2Fclazy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KDE%2Fclazy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KDE","download_url":"https://codeload.github.com/KDE/clazy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243690118,"owners_count":20331725,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T22:01:12.778Z","updated_at":"2025-03-15T05:30:28.678Z","avatar_url":"https://github.com/KDE.png","language":"C++","funding_links":[],"categories":["TODO scan for Android support in followings","C++","Programming Languages"],"sub_categories":[],"readme":"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.\n\nTable of contents\n=================\n\n   * [Source Code](#source-code)\n   * [Build Instructions](#build-instructions)\n      * [Linux](#linux)\n         * [Install dependencies](#install-dependencies)\n         * [Build and install clang](#build-and-install-clang)\n         * [Build clazy](#build-clazy)\n      * [Windows](#windows)\n         * [Build and install clang](#build-and-install-clang-1)\n         * [Build clazy](#build-clazy-1)\n      * [macOS with MacPorts](#macos-with-macports)\n         * [Install clang](#install-clang)\n         * [Build clazy](#build-clazy-2)\n      * [macOS with Homebrew](#macos-with-homebrew)\n         * [Install clang](#install-clang-1)\n         * [Build clazy](#build-clazy-3)\n   * [Setting up your project to build with clazy](#setting-up-your-project-to-build-with-clazy)\n   * [List of checks](#list-of-checks)\n   * [Selecting which checks to enable](#selecting-which-checks-to-enable)\n      * [Example via env variable](#example-via-env-variable)\n      * [Example via compiler argument](#example-via-compiler-argument)\n   * [clazy-standalone and JSON database support](#clazy-standalone-and-json-database-support)\n   * [Enabling Fixits](#enabling-fixits)\n   * [Troubleshooting](#troubleshooting)\n   * [Reducing warning noise](#reducing-warning-noise)\n   * [Reporting bugs and wishes](#reporting-bugs-and-wishes)\n   * [Authors](#authors)\n   * [Contributing patches](#contributing-patches)\n\n# Source Code\n\nYou can get clazy from:\n\n- \u003chttps://github.com/KDE/clazy\u003e\n- \u003chttps://invent.kde.org/sdk/clazy\u003e\n\n\n# Supported platforms\n\nClazy has been tested on Linux, macOS and Windows/MSVC.\nOther platforms are not supported but we'll gladly accept patches.\n\n\n# Build Instructions\n## Linux\n\n### Install dependencies\n- OpenSUSE tumbleweed: `zypper install cmake git-core llvm llvm-devel llvm-clang llvm-clang-devel`\n- Ubuntu: `apt install g++ cmake clang llvm-dev git-core libclang-dev`\n- Archlinux: `pacman -S make llvm clang python2 cmake git gcc`\n- Fedora: be sure to *remove* the llvm-static package and only install the one with dynamic libraries\n- Other distros: Check llvm/clang build docs.\n\n### Build and install clang\nclang and LLVM \u003e= 11.0 are required.\n\nIf your distro provides clang then you can skip this step.\n\n\n```\n  $ git clone https://github.com/llvm-mirror/llvm.git \u003csome_directory\u003e\n  $ cd \u003csome_directory\u003e/tools/ \u0026\u0026 git clone https://github.com/llvm-mirror/clang.git\n  $ cd \u003csome_directory\u003e/projects \u0026\u0026 git clone https://github.com/llvm-mirror/compiler-rt.git\n  $ mkdir \u003csome_directory\u003e/build \u0026\u0026 cd \u003csome_directory\u003e/build\n  $ cmake -DCMAKE_INSTALL_PREFIX=\u003cprefix\u003e -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release -G Ninja ..\n  $ cmake --build .\n  $ cmake --build . --target install\n```\n\n### Build clazy\n```\n  $ cd clazy/\n  $ cmake -DCMAKE_INSTALL_PREFIX=\u003cprefix\u003e -DCMAKE_BUILD_TYPE=Release -G Ninja\n  $ cmake --build .\n  $ cmake --build . --target install\n```\n\nSee troubleshooting section if you have problems.\n\n## Windows\n\n### Build and install clang\nThese instructions assume your terminal is suitable for development.\nNinja (or equivalent), git, cmake, and cl (msvc2022) should be in your PATH.\n\nclang and LLVM \u003e= 11.0 are required.\n\nBe sure to pass -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON to CMake when building LLVM, otherwise clazy won't work.\n\n```\n  \u003e git clone https://github.com/llvm/llvm-project.git -b llvmorg-11.0.0 \u003csome_directory\u003e\n  \u003e mkdir build # Important that this is outside of the source directory\n  \u003e cd build\n  \u003e 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\" ../\u003csome_directory\u003e/llvm\n  \u003e cmake --build .\n  \u003e cmake --build . --target install\n  \u003e Add c:\\my_install_folder\\llvm\\bin\\ to PATH\n```\n\nAlso 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.\nUnfortunately LLVM doesn't install it. You can put it anywhere, just save it so you can delete the build directory.\n\n### Build clazy\n\nBe sure to point CLANG_LIBRARY_IMPORT to clang.lib. It's probably inside your LLVM build dir since it doesn't get installed.\n\n```\n  \u003e cd clazy\\\n  \u003e 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\"\n  \u003e cmake --build .\n  \u003e cmake --build . --target install\n```\n\n## macOS with MacPorts\n\n### Install clang\n```\n$ sudo port install llvm-11 clang-11 cmake ninja coreutils\n$ sudo ln -sf /opt/local/bin/llvm-config-mp-11 /opt/local/bin/llvm-config\n$ sudo port select --set clang mp-clang-11\n```\n\n### Build clazy\n```\n  $ export CXX=clang++\n  $ cmake -G Ninja\n  $ cmake --build .\n  $ cmake --build . --target install\n```\n\n## macOS with Homebrew\n\nThe recommended way is to build clazy yourself, but alternatively you can try user recipes, such as:\n\n```\n$ brew install kde-mac/kde/clazy\n```\n\nfor stable branch, or for master:\n\n```\n$ brew install kde-mac/kde/clazy --HEAD\n```\n\nAs these are not verified or tested by the clazy developers please don't report bugs to us.\n\nFor building yourself, read on. You'll have to install clang and build clazy from source.\n\n### Install clang\n\n```\n$ brew install --with-clang llvm\n```\n\n### Build clazy\n```\n  $ export CXX=clang++\n  $ export LLVM_ROOT=/usr/local/opt/llvm\n  $ cmake -G Ninja\n  $ cmake --build .\n  $ cmake --build . --target install\n```\n\n# Setting up your project to build with clazy\n\nNote: 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.\nNote: 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).\n\nYou should now have the clazy command available to you, in `\u003cprefix\u003e/bin/`.\nCompile your programs with it instead of clang++/g++.\n\nNote that this command is just a convenience wrapper which calls:\n`clang++ -Xclang -load -Xclang ClazyPlugin.so -Xclang -add-plugin -Xclang clazy`\n\nIf you have multiple versions of clang installed (say clang++-10 and clang++-11)\nyou can choose which one to use by setting the CLANGXX environment variable, like so:\n`export CLANGXX=clang++-11; clazy`\n\nTo build a CMake project use:\n `cmake . -DCMAKE_CXX_COMPILER=clazy`\nand rebuild.\n\nTo make it the compiler for qmake projects, just run qmake like:\n`qmake -spec linux-clang QMAKE_CXX=\"clazy\"`\n\nOn Windows with MSVC it's simply: `qmake QMAKE_CXX=\"clazy-cl.bat\"`\n\nAlternatively, if you want to use clang directly, without the wrapper:\n`qmake -spec linux-clang QMAKE_CXXFLAGS=\"-Xclang -load -Xclang ClazyPlugin.so -Xclang -add-plugin -Xclang clazy\"`\n\nOn Windows it's similar, just inspect the contents of `clazy-cl.bat`.\n\n\nIt's recommended that you disable pre-compiled headers and don't use ccache.\n\nYou're all set, clazy will now run some checks on your project, but not all of them.\nRead on if you want to enable/disable which checks are run.\n\n# List of checks\n\nThere are many checks and they are divided in levels:\n- level0: Very stable checks, 99.99% safe, mostly no false-positives, very desirable\n- level1: The default level. Very similar to level 0, slightly more false-positives but very few.\n- level2: Also very few false-positives, but contains noisy checks which not everyone agree should be default.\n- manual: Checks here need to be enabled explicitly, as they don't belong to any level. They can be very stable or very unstable.\n\nclazy runs all checks from level1 by default.\n\n- Checks from Manual Level:\n    - [assert-with-side-effects](docs/checks/README-assert-with-side-effects.md)\n    - [container-inside-loop](docs/checks/README-container-inside-loop.md)\n    - [detaching-member](docs/checks/README-detaching-member.md)\n    - [heap-allocated-small-trivial-type](docs/checks/README-heap-allocated-small-trivial-type.md)\n    - [ifndef-define-typo](docs/checks/README-ifndef-define-typo.md)\n    - [isempty-vs-count](docs/checks/README-isempty-vs-count.md)\n    - [jni-signatures](docs/checks/README-jni-signatures.md)\n    - [qbytearray-conversion-to-c-style](docs/checks/README-qbytearray-conversion-to-c-style.md)    (fix-qbytearray-conversion-to-c-style)\n    - [qhash-with-char-pointer-key](docs/checks/README-qhash-with-char-pointer-key.md)\n    - [qproperty-type-mismatch](docs/checks/README-qproperty-type-mismatch.md)\n    - [qrequiredresult-candidates](docs/checks/README-qrequiredresult-candidates.md)\n    - [qstring-varargs](docs/checks/README-qstring-varargs.md)\n    - [qt-keyword-emit](docs/checks/README-qt-keyword-emit.md)    (fix-qt-keyword-emit)\n    - [qt-keywords](docs/checks/README-qt-keywords.md)    (fix-qt-keywords)\n    - [qt6-deprecated-api-fixes](docs/checks/README-qt6-deprecated-api-fixes.md)    (fix-qt6-deprecated-api-fixes)\n    - [qt6-fwd-fixes](docs/checks/README-qt6-fwd-fixes.md)    (fix-qt6-fwd-fixes)\n    - [qt6-header-fixes](docs/checks/README-qt6-header-fixes.md)    (fix-qt6-header-fixes)\n    - [qt6-qhash-signature](docs/checks/README-qt6-qhash-signature.md)    (fix-qt6-qhash-signature)\n    - [qt6-qlatin1stringchar-to-u](docs/checks/README-qt6-qlatin1stringchar-to-u.md)    (fix-qt6-qlatin1stringchar-to-u)\n    - [qvariant-template-instantiation](docs/checks/README-qvariant-template-instantiation.md)\n    - [raw-environment-function](docs/checks/README-raw-environment-function.md)\n    - [reserve-candidates](docs/checks/README-reserve-candidates.md)\n    - [sanitize-inline-keyword](docs/checks/README-sanitize-inline-keyword.md)    (fix-sanitize-inline-keyword)\n    - [signal-with-return-value](docs/checks/README-signal-with-return-value.md)\n    - [thread-with-slots](docs/checks/README-thread-with-slots.md)\n    - [tr-non-literal](docs/checks/README-tr-non-literal.md)\n    - [unexpected-flag-enumerator-value](docs/checks/README-unexpected-flag-enumerator-value.md)\n    - [unneeded-cast](docs/checks/README-unneeded-cast.md)\n    - [unused-result-check](docs/checks/README-unused-result-check.md)\n    - [use-arrow-operator-instead-of-data](docs/checks/README-use-arrow-operator-instead-of-data.md)\n    - [use-chrono-in-qtimer](docs/checks/README-use-chrono-in-qtimer.md)\n    - [used-qunused-variable](docs/checks/README-used-qunused-variable.md)\n\n- Checks from Level 0:\n    - [connect-by-name](docs/checks/README-connect-by-name.md)\n    - [connect-non-signal](docs/checks/README-connect-non-signal.md)\n    - [connect-not-normalized](docs/checks/README-connect-not-normalized.md)\n    - [container-anti-pattern](docs/checks/README-container-anti-pattern.md)\n    - [empty-qstringliteral](docs/checks/README-empty-qstringliteral.md)\n    - [fully-qualified-moc-types](docs/checks/README-fully-qualified-moc-types.md)    (fix-fully-qualified-moc-types)\n    - [lambda-in-connect](docs/checks/README-lambda-in-connect.md)\n    - [lambda-unique-connection](docs/checks/README-lambda-unique-connection.md)\n    - [lowercase-qml-type-name](docs/checks/README-lowercase-qml-type-name.md)\n    - [mutable-container-key](docs/checks/README-mutable-container-key.md)\n    - [no-module-include](docs/checks/README-no-module-include.md)\n    - [overloaded-signal](docs/checks/README-overloaded-signal.md)\n    - [qcolor-from-literal](docs/checks/README-qcolor-from-literal.md)    (fix-qcolor-from-literal)\n    - [qdatetime-utc](docs/checks/README-qdatetime-utc.md)    (fix-qdatetime-utc)\n    - [qenums](docs/checks/README-qenums.md)\n    - [qfileinfo-exists](docs/checks/README-qfileinfo-exists.md)    (fix-qfileinfo-exists)\n    - [qgetenv](docs/checks/README-qgetenv.md)    (fix-qgetenv)\n    - [qmap-with-pointer-key](docs/checks/README-qmap-with-pointer-key.md)\n    - [qstring-arg](docs/checks/README-qstring-arg.md)\n    - [qstring-comparison-to-implicit-char](docs/checks/README-qstring-comparison-to-implicit-char.md)\n    - [qstring-insensitive-allocation](docs/checks/README-qstring-insensitive-allocation.md)\n    - [qstring-ref](docs/checks/README-qstring-ref.md)    (fix-missing-qstringref)\n    - [qt-macros](docs/checks/README-qt-macros.md)\n    - [strict-iterators](docs/checks/README-strict-iterators.md)\n    - [temporary-iterator](docs/checks/README-temporary-iterator.md)\n    - [unused-non-trivial-variable](docs/checks/README-unused-non-trivial-variable.md)\n    - [use-static-qregularexpression](docs/checks/README-use-static-qregularexpression.md)\n    - [writing-to-temporary](docs/checks/README-writing-to-temporary.md)\n    - [wrong-qevent-cast](docs/checks/README-wrong-qevent-cast.md)\n    - [wrong-qglobalstatic](docs/checks/README-wrong-qglobalstatic.md)\n\n- Checks from Level 1:\n    - [auto-unexpected-qstringbuilder](docs/checks/README-auto-unexpected-qstringbuilder.md)    (fix-auto-unexpected-qstringbuilder)\n    - [child-event-qobject-cast](docs/checks/README-child-event-qobject-cast.md)\n    - [connect-3arg-lambda](docs/checks/README-connect-3arg-lambda.md)\n    - [const-signal-or-slot](docs/checks/README-const-signal-or-slot.md)\n    - [detaching-temporary](docs/checks/README-detaching-temporary.md)\n    - [foreach](docs/checks/README-foreach.md)\n    - [incorrect-emit](docs/checks/README-incorrect-emit.md)\n    - [install-event-filter](docs/checks/README-install-event-filter.md)\n    - [non-pod-global-static](docs/checks/README-non-pod-global-static.md)\n    - [overridden-signal](docs/checks/README-overridden-signal.md)\n    - [post-event](docs/checks/README-post-event.md)\n    - [qdeleteall](docs/checks/README-qdeleteall.md)\n    - [qhash-namespace](docs/checks/README-qhash-namespace.md)\n    - [qlatin1string-non-ascii](docs/checks/README-qlatin1string-non-ascii.md)\n    - [qproperty-without-notify](docs/checks/README-qproperty-without-notify.md)\n    - [qstring-left](docs/checks/README-qstring-left.md)\n    - [range-loop-detach](docs/checks/README-range-loop-detach.md)    (fix-range-loop-add-qasconst)\n    - [range-loop-reference](docs/checks/README-range-loop-reference.md)    (fix-range-loop-add-ref)\n    - [returning-data-from-temporary](docs/checks/README-returning-data-from-temporary.md)\n    - [rule-of-two-soft](docs/checks/README-rule-of-two-soft.md)\n    - [skipped-base-method](docs/checks/README-skipped-base-method.md)\n    - [virtual-signal](docs/checks/README-virtual-signal.md)\n\n- Checks from Level 2:\n    - [base-class-event](docs/checks/README-base-class-event.md)\n    - [copyable-polymorphic](docs/checks/README-copyable-polymorphic.md)\n    - [ctor-missing-parent-argument](docs/checks/README-ctor-missing-parent-argument.md)\n    - [function-args-by-ref](docs/checks/README-function-args-by-ref.md)    (fix-function-args-by-ref)\n    - [function-args-by-value](docs/checks/README-function-args-by-value.md)\n    - [global-const-char-pointer](docs/checks/README-global-const-char-pointer.md)\n    - [implicit-casts](docs/checks/README-implicit-casts.md)\n    - [missing-qobject-macro](docs/checks/README-missing-qobject-macro.md)    (fix-missing-qobject-macro)\n    - [missing-typeinfo](docs/checks/README-missing-typeinfo.md)\n    - [old-style-connect](docs/checks/README-old-style-connect.md)    (fix-old-style-connect)\n    - [qstring-allocations](docs/checks/README-qstring-allocations.md)    (fix-qlatin1string-allocations,fix-fromLatin1_fromUtf8-allocations,fix-fromCharPtrAllocations)\n    - [returning-void-expression](docs/checks/README-returning-void-expression.md)\n    - [rule-of-three](docs/checks/README-rule-of-three.md)\n    - [static-pmf](docs/checks/README-static-pmf.md)\n    - [virtual-call-ctor](docs/checks/README-virtual-call-ctor.md)\n\n# Selecting which checks to enable\n\nYou may want to choose which checks to enable before starting to compile.\nIf you don't specify anything then all checks from level0 and level1 will run.\nTo 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.\nYou can disable checks by prefixing with `no-`, in case you don't want all checks from a given level.\n\n## Example via env variable\n```\nexport CLAZY_CHECKS=\"unneeded-cast,qmap-with-pointer-key,virtual-call-ctor\" # Enables only these 3 checks\nexport CLAZY_CHECKS=\"level0,no-qenums\" # Enables all checks from level0, except for qenums\nexport CLAZY_CHECKS=\"level0,detaching-temporary\" # Enables all from level0 and also detaching-temporary\n```\n## Example via compiler argument\n`clazy -Xclang -plugin-arg-clazy -Xclang level0,detaching-temporary`\nDon't forget to re-run cmake/qmake/etc if you altered the c++ flags to specify flags.\n\n# clazy-standalone and JSON database support\n\nThe `clazy-standalone` binary allows you to run clazy over a compilation database JSON file, in the same\nway you would use `clang-tidy` or other clang tooling. This way you don't need to build your application,\nonly the static analysis is performed.\n\nNote: If you're using the AppImage, use `Clazy-x86_64.AppImage --standalone` instead of `clazy-standalone`.\n\n`clazy-standalone` supports the same env variables as the clazy plugin. You can also specify a list of checks via\nthe `-checks` argument.\n\n\nRunning on one cpp file:\n`clazy-standalone -checks=install-event-filter,qmap-with-pointer-key,level0 -p compile_commands.json my.file.cpp`\n\nRunning on all cpp files:\n`find . -name \"*cpp\" | xargs clazy-standalone -checks=level2 -p default/compile_commands.json`\n\nSee https://clang.llvm.org/docs/JSONCompilationDatabase.html for how to generate the compile_commands.json file. Basically it's generated\nby 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`:\n\n`qbs generate --generator clangdb`\n\n**Note:** Be sure the clazy-standalone binary is located in the same folder as the clang binary, otherwise it will have trouble\nfinding builtin headers, like stddef.h. Alternatively, you can symlink to the folder containing the builtin headers:\n\n(Assuming clazy was built with `-DCMAKE_INSTALL_PREFIX=/myprefix/`)\n\n```\n$ touch foo.c \u0026\u0026 clang++ '-###' -c foo.c 2\u003e\u00261 | 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.\n  \"-resource-dir\"\n  \"/opt/local/libexec/llvm-8.0/lib/clang/8.0.1\" # The interesting part is /opt/local/libexec/llvm-8.0\n$ ln -sf /opt/local/libexec/llvm-8.0/lib/clang/ /myprefix/lib/clang\n$ mkdir /myprefix/include/\n$ ln -sf /opt/local/libexec/llvm-8.0/include/c++/ /myprefix/include/c++ # Required on macOS\n```\n\nIf that doesn't work, run `clang -v` and check what's the InstalledDir. Move clazy-standalone to that folder.\n\n`clang-tidy` support will be added after \u003chttps://github.com/llvm/llvm-project/issues/32086\u003e is fixed.\n\n# Enabling Fixits\n\nSome checks support fixits, in which clazy will help re-write your source files whenever it can fix something.\nSimply pass `-Xclang -plugin-arg-clazy -Xclang export-fixes` to clang, or `-export-fixes=somefile.yaml` for `clazy-standalone`.\nAlternatively, set the `CLAZY_EXPORT_FIXES` env variable (works only with the plugin, not with standalone).\nThen run `clang-apply-replacements \u003cfolder_with_yaml_files\u003e`, which will modify your code.\n\nWhen using fixits, prefer to run only a single check each time, so they don't conflict\nwith each other modifying the same source lines.\n\n**WARNING**: Backup your code and make sure all changes done by clazy are correct.\n\n# Troubleshooting\n\n- clang: symbol lookup error: `/usr/lib/x86_64-linux-gnu/ClazyPlugin.so: undefined symbol: _ZNK5clang15DeclarationName11getAsStringEv`.\n  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]).\n\n  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.\n\n[1]: https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html\n[2]: https://llvm.org/bugs/show_bug.cgi?id=23529\n\n- [Fedora] cmake can't find LLVM ?\n  Try building llvm/clang yourself\n  (There are reports that /usr/share/llvm/cmake/LLVM-Config.cmake is buggy).\n\n- [Fedora] CommandLine Error: `Option 'opt-bisect-limit' registered more than once!`\n  Remove the llvm-static package and use the dynamically linked libraries instead.\n  Alternatively, if you want to use llvm-static, see next item.\n\n- CommandLine Error: `Option 'foo' registered more than once!`\n  Means you're building against a static version of LLVM (*.a files instead of *.so).\n  Try passing to cmake -DLINK_CLAZY_TO_LLVM=OFF when building clazy, this was tested\n  successfully against a static LLVM 7.0, and might work with other versions.\n\n- Some checks are mysteriously not producing warnings or not applying fixits ?\n  Check if you have ccache interfering and turn it off.\n\n- fatal error: 'stddef.h' file not found, while using `clazy-standalone`\n  Be sure the clazy-standalone binary is located in the same folder as the clang binary.\n\n- Be sure to disable pch.\n\n- macOS: Be sure you're not using Apple Clang\n\n- macOS: System Integrity Protection blocks the use of DYLD_LIBRARY_PATH. With SIP enabled you need to pass the full path\n  to ClazyPlugin.dylib, otherwise you'll get `image not found` error.\n\n- Windows: fatal error LNK1112: module machine type ‘X86’ conflicts with target machine type ‘x64’\n  If you're building in 32-bit, open clazy-cl.bat and insert a -m32 argument.\n  Should read: %~dp0\\clang\\clang.exe –driver-mode=cl -m32 (...)\n\n# Reducing warning noise\n\nIf you think you found a false-positive, file a bug report. But do make sure to test first without icecc/distcc enabled.\n\nIf you want to suppress warnings from headers of Qt or 3rd party code, include them with `-isystem` instead of `-I` (gcc/clang only).\nFor MSVC use `/external`, which is available since VS 15.6.\n\nAlternatively you can set the CLAZY_HEADER_FILTER env variable to a regexp matching the path where you want warnings,\nfor example `CLAZY_HEADER_FILTER=.*myapplication.*`.\n\nYou can also exclude paths using a regexp by setting CLAZY_IGNORE_DIRS, for example `CLAZY_IGNORE_DIRS=.*my_qt_folder.*`.\n\nYou can also suppress individual warnings by file or by line by inserting comments:\n\n- To disable clazy in a specific source file, insert this comment, anywhere in the file:\n`// clazy:skip`\n\n- To disable specific checks in a source file, insert a comment such as\n`// clazy:excludeall=check1,check2`\n\n- To disable specific checks in specific source lines, insert a comment in the same line as the warning:\n`(...) // clazy:exclude=check1,check2`\n\n- To disable specific checks in source files for the following line, insert a comment:\n`// clazy:exclude=check1,check2`\n\nDon't include the `clazy-` prefix. If, for example, you want to disable qstring-allocations you would write:\n`// clazy:exclude=qstring-allocations` not `clazy-qstring-allocations`.\n\n# Reporting bugs and wishes\n\n- bug tracker: \u003chttps://bugs.kde.org/enter_bug.cgi?product=clazy\u003e\n- IRC: #kde-clazy (irc.libera.chat)\n- E-mail: \u003csmartins at kde.org\u003e\n\nWhen reporting a bug *please* include a minimal compilable testcase. No matter\nhow simple it is, it saves me time from deciphering a bug report. Time spent\ndoing triaging is time not spent writing fixes.\n\nA minimal testcase is also something I can copy to the test suite.\n\nMake sure you can reproduce with clazy (outside of QtCreator), otherwise it can be a QtCreator bug instead,\nwhich you can report at \u003chttps://bugreports.qt.io/\u003e.\n\n\n# Authors\n\n- Sérgio Martins\n\nwith contributions from:\n\n- Allen Winter\n- Kevin Funk\n- Mathias Hasselmann\n- Laurent Montel\n- Albert Astals Cid\n- Aurélien Gâteau\n- Hannah von Reth\n- Volker Krause\n- Christian Ehrlicher\n- Christian Gagneraud\n- Nikolai Kosjar\n- Jesper K. Pedersen\n- Lucie Gerard\n- Christian Schärf\n- Waqar Ahmed\n- Alexander Lohnau\n\nqt6-* porting checks written by Lucie Gerard \u003clucie.gerard@qt.io\u003e\n\nand thanks to:\n\n- Klarälvdalens Datakonsult AB (\u003chttp://www.kdab.com\u003e), for letting me work on clazy as a research project\n\n\n# Contributing patches\n\nNew features go to master and bug fixes go to the last 1.X branch.\nThe preferred way to contributing is by using KDE's GitLab instance,\nsee \u003chttps://community.kde.org/Infrastructure/GitLab\u003e.\n\nIf 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\nthe 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).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKDE%2Fclazy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKDE%2Fclazy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKDE%2Fclazy/lists"}