[PATCH] D67567: [clang-tidy] New check to warn when storing dispatch_once_t in non-static, non-global storage
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 16 10:12:04 PDT 2019
lebedev.ri added a comment.
In D67567#1671499 <https://reviews.llvm.org/D67567#1671499>, @mwyman wrote:
> In D67567#1670264 <https://reviews.llvm.org/D67567#1670264>, @NoQ wrote:
>
> > FTR, we already have a similar Static Analyzer check, eg.:
> > https://github.com/llvm-mirror/clang/blob/release_80/test/Analysis/dispatch-once.m#L15
> > https://github.com/llvm-mirror/clang/blob/release_80/test/Analysis/dispatch-once.m#L26
> >
> > Your check is a bit more aggressive but i don't see why didn't we do it that way in the first place :) Though you won't be able to warn on the heap example.
>
>
> The Static Analyzer check was pointed out by a colleague; unfortunately our build environment doesn't currently play nice with running the static analyzer (so many devs don't end up running it) but ClangTidy gets run as part of our code review process. Given libdispatch's documented requirements, it seemed reasonable to be aggressive with a ClangTidy check when we can reasonably identify non-static/global storage.
You can run static analyzer checks as normal clang-tidy checks.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67567/new/
https://reviews.llvm.org/D67567
More information about the cfe-commits
mailing list