WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
212280
[CMake] Add static analyzers
https://bugs.webkit.org/show_bug.cgi?id=212280
Summary
[CMake] Add static analyzers
Don Olmstead
Reported
2020-05-22 14:30:25 PDT
Add some static analyzers supported through CMake. IWYU, clang-tidy, LWYU.
Attachments
Patch
(7.54 KB, patch)
2020-05-22 14:46 PDT
,
Don Olmstead
no flags
Details
Formatted Diff
Diff
Patch
(7.55 KB, patch)
2020-05-22 14:50 PDT
,
Don Olmstead
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Don Olmstead
Comment 1
2020-05-22 14:46:37 PDT
Comment hidden (obsolete)
Created
attachment 400078
[details]
Patch
Don Olmstead
Comment 2
2020-05-22 14:50:22 PDT
Created
attachment 400079
[details]
Patch
David Kilzer (:ddkilzer)
Comment 3
2020-05-22 16:17:31 PDT
Comment on
attachment 400079
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=400079&action=review
r=me
> ChangeLog:11 > + Add support for static analyzers within CMake builds. Supported analyzers are > + clang-tidy, iwyu (include-what-you-use) and lwyu (link-what-you-use). They can > + be enabled by passing a semicolon separated list to CMake through the ANALYZERS > + option.
Is the clang static analyzer supported in a different way? (I'm curious because that's the first "analyzer" I think of when I see the word. No need to change this patch to accomodate.)
> Source/cmake/WebKitFeatures.cmake:92 > + message(STATUS "Unified builds are disabled when analyzing sources")
I'm curious why this is. When using the clang static analyzer, it's actually more useful to build with unified sources because it gives the static analyzer more code to work with (especially in deep mode).
David Kilzer (:ddkilzer)
Comment 4
2020-05-22 16:19:01 PDT
Comment on
attachment 400079
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=400079&action=review
>> Source/cmake/WebKitFeatures.cmake:92 >> + message(STATUS "Unified builds are disabled when analyzing sources") > > I'm curious why this is. When using the clang static analyzer, it's actually more useful to build with unified sources because it gives the static analyzer more code to work with (especially in deep mode).
Okay, I see why disabling this would be useful for IWYU, but it probably doesn't make a difference on the other two (unless clang-tidy gets too slow or uses too much memory with unified sources).
Don Olmstead
Comment 5
2020-05-26 10:29:58 PDT
Comment on
attachment 400079
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=400079&action=review
>> ChangeLog:11 >> + option. > > Is the clang static analyzer supported in a different way? (I'm curious because that's the first "analyzer" I think of when I see the word. No need to change this patch to accomodate.)
My understanding is that the clang static analyzer runs by masquerading as a compiler.
https://stackoverflow.com/a/21785566
To support it for ports using CMake I think you'd need to do something like the above potentially in the build-webkit script. I haven't been able to find the magical invocation to make it work on Windows but that would be my assumption.
>>> Source/cmake/WebKitFeatures.cmake:92 >>> + message(STATUS "Unified builds are disabled when analyzing sources") >> >> I'm curious why this is. When using the clang static analyzer, it's actually more useful to build with unified sources because it gives the static analyzer more code to work with (especially in deep mode). > > Okay, I see why disabling this would be useful for IWYU, but it probably doesn't make a difference on the other two (unless clang-tidy gets too slow or uses too much memory with unified sources).
I split this off of
https://bugs.webkit.org/show_bug.cgi?id=206738
which specifically wants UNIFIED_BUILDS turned off. The link-what-you-use functionality just plays with linker options to determine if something isn't used by the linker so it seemed excessive to turn off unified builds over that hence the check for the EXEs.
Michael Catanzaro
Comment 6
2020-05-26 11:27:36 PDT
(In reply to Don Olmstead from
comment #5
)
> To support it for ports using CMake I think you'd need to do something like > the above potentially in the build-webkit script. I haven't been able to > find the magical invocation to make it work on Windows but that would be my > assumption.
I think setting -DCMAKE_CXX_COMPILER=scan-build might suffice, but haven't tried this.
EWS
Comment 7
2020-05-26 12:29:33 PDT
Committed
r262156
: <
https://trac.webkit.org/changeset/262156
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 400079
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug