[PATCH] D127898: [clang][dataflow] Find unsafe locs after fixpoint
Gábor Horváth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 17 10:11:49 PDT 2022
xazax.hun added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/UncheckedOptionalAccessCheck.cpp:66
+ SourceLocations Locs;
+ for (const CFGBlock *Block : Context->getCFG()) {
+ // Skip blocks that were not evaluated.
----------------
While doing yet another iteration after we reached the fixed point is a valid approach, many analyses have a monotonic property when it comes to emitting diagnostics. In this case, when the analysis discovered that an optional access is unsafe in one of the iterations I would not expect it to become safe in subsequent iterations. In most of the cases this makes collecting diagnostics eagerly a viable option and saves us from doing one more traversal of the CFG. On the other hand, we need to be careful to not to emit duplicate diagnostics.
I wonder whether, from a user point of view, not having to do one more iteration is a more ergonomic interface.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127898/new/
https://reviews.llvm.org/D127898
More information about the cfe-commits
mailing list