Bug 206738

Summary: [CMake] Provide a “tooling build” configuration option
Product: WebKit Reporter: Adrian Perez <aperez>
Component: CMakeAssignee: Don Olmstead <don.olmstead>
Status: ASSIGNED    
Severity: Normal CC: cgarcia, clopez, ddkilzer, don.olmstead
Priority: P2    
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=213173
https://bugs.webkit.org/show_bug.cgi?id=68910
Bug Depends on:    
Bug Blocks: 206737    
Attachments:
Description Flags
WIP Patch
none
WIP Patch
none
WIP Patch none

Adrian Perez
Reported 2020-01-24 05:03:16 PST
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).
Attachments
WIP Patch (6.90 KB, patch)
2020-05-07 16:24 PDT, Don Olmstead
no flags
WIP Patch (9.18 KB, patch)
2020-05-07 21:46 PDT, Don Olmstead
no flags
WIP Patch (6.35 KB, patch)
2020-05-15 14:16 PDT, Don Olmstead
no flags
Carlos Alberto Lopez Perez
Comment 1 2020-01-24 06:39:11 PST
(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?
Don Olmstead
Comment 2 2020-01-30 09:42:06 PST
(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.
Adrian Perez
Comment 3 2020-01-31 00:36:15 PST
(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.
Don Olmstead
Comment 4 2020-05-07 16:24:05 PDT Comment hidden (obsolete)
Don Olmstead
Comment 5 2020-05-07 21:46:08 PDT Comment hidden (obsolete)
Don Olmstead
Comment 6 2020-05-15 14:16:59 PDT
Created attachment 399510 [details] WIP Patch
Don Olmstead
Comment 7 2020-05-15 14:28:26 PDT
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
David Kilzer (:ddkilzer)
Comment 8 2020-06-17 18:28:59 PDT
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.)
Note You need to log in before you can comment on or make changes to this bug.