I am splitting this out from bug #206737 because I think it will be uncontroversial. The idea is to have a build option which does whatever is needed to make standard tools work with a compilation database (a.k.a. that “compile_commands.json” file). At least such an option should: - Set CMAKE_EXPORT_COMPILE_COMMANDS=ON (yay!) - Set ENABLE_DEVELOPER_BUILD=ON (of course!) - Set ENABLE_UNIFIED_BUILDS=OFF (because unified builds play badly with many third-party tools, ouch!) - Define a target which can be used to generate all the needed derived sources and copy forwarding headers, so it's possible to run “ninja tooling-prepare“ (or similar).
(In reply to Adrian Perez from comment #0) > - Set ENABLE_UNIFIED_BUILDS=OFF (because unified builds play > badly with many third-party tools, ouch!) Any example of such tools?
(In reply to Carlos Alberto Lopez Perez from comment #1) > (In reply to Adrian Perez from comment #0) > > - Set ENABLE_UNIFIED_BUILDS=OFF (because unified builds play > > badly with many third-party tools, ouch!) > > Any example of such tools? A lot of the clang tools. I'd really like to run include-what-you-use over the codebase. Would also be nice to use clang-tidy especially if we can integrate it into the style checker and maybe even write our own rules.
(In reply to Don Olmstead from comment #2) > (In reply to Carlos Alberto Lopez Perez from comment #1) > > (In reply to Adrian Perez from comment #0) > > > - Set ENABLE_UNIFIED_BUILDS=OFF (because unified builds play > > > badly with many third-party tools, ouch!) > > > > Any example of such tools? > > A lot of the clang tools. I'd really like to run include-what-you-use over > the codebase. Would also be nice to use clang-tidy especially if we can > integrate it into the style checker and maybe even write our own rules. Another (IMO important) one is scan-build, for static analysis. Also, LSP (Language Server Protocol) plug-ins for editors and IDEs need a compilation database that reflects what the actual sources are, without unified sources.
Created attachment 398810 [details] WIP Patch
Created attachment 398835 [details] WIP Patch
Created attachment 399510 [details] WIP Patch
To run the work in progress patch you need to pass a CMake arg, ANALYZERS, and that can be any combination of clang-tidy iwyu and lwyu. For example here's what my command line looks like for running this on WinCairo. ``` perl .\Tools\Scripts\build-webkit --wincairo --skip-library-update --generate-project-only --cmakeargs='-DANALYZERS="iwyu"' ``` You can specify multiple by doing ; between values. ``` perl .\Tools\Scripts\build-webkit --wincairo --skip-library-update --generate-project-only --cmakeargs='-DANALYZERS="clang-tidy;iwyu"' ``` For OS X users theres brew for getting it installed https://formulae.brew.sh/formula/include-what-you-use For Linux users theres an apt-get For Windows users you need to build it yourself
To find issues with uninitialized data members in structs/classes like: Bug 213173: REGRESSION(r262994): [GTK] More than 100 tests are failing We can use the following checkers: optin.cplusplus.UninitializedObject -- clang static analyzer <https://clang.llvm.org/docs/analyzer/checkers.html#optin-cplusplus-uninitializedobject-c> cppcoreguidelines-pro-type-member-init -- clang tidy <https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-pro-type-member-init.html> (I'm adding this comment here in case we use this to decide which checkers to enable.)