[all-commits] [llvm/llvm-project] f1a7d5: [-Wcalled-once-parameter] Harden analysis in terms...
Valeriy Savchenko via All-commits
all-commits at lists.llvm.org
Thu Mar 18 02:13:18 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f1a7d5a7b0ec810057ff6e88371ab86d1fce812c
https://github.com/llvm/llvm-project/commit/f1a7d5a7b0ec810057ff6e88371ab86d1fce812c
Author: Valeriy Savchenko <vsavchenko at apple.com>
Date: 2021-03-18 (Thu, 18 Mar 2021)
Changed paths:
M clang/include/clang/Analysis/Analyses/CalledOnceCheck.h
M clang/include/clang/Sema/AnalysisBasedWarnings.h
M clang/lib/Analysis/CalledOnceCheck.cpp
M clang/lib/Sema/AnalysisBasedWarnings.cpp
M clang/test/SemaObjC/warn-called-once.m
Log Message:
-----------
[-Wcalled-once-parameter] Harden analysis in terms of block use
This patch introduces a very simple inter-procedural analysis
between blocks and enclosing functions.
We always analyze blocks first (analysis is done as part of semantic
analysis that goes side-by-side with the parsing process), and at the
moment of reporting we don't know how that block will be actually
used.
This patch introduces new logic delaying reports of the "never called"
warnings on blocks. If we are not sure that the block will be called
exactly once, we shouldn't warn our users about that. Double calls,
however, don't require such delays. While analyzing the enclosing
function, we can actually decide what we should do with those
warnings.
Additionally, as a side effect, we can be more confident about blocks
in such context and can treat them not as escapes, but as direct
calls.
rdar://74090107
Differential Revision: https://reviews.llvm.org/D98688
More information about the All-commits
mailing list