Skip to content

Commit c368a72

Browse files
authored
[clang] Merge lifetimebound and GSL code paths for lifetime analysis (llvm#104906)
In the current lifetime analysis, we have two parallel code paths: one for lifetimebound and another for GSL. These paths perform the same logic, both determining whether to continue visiting subexpressions. This PR merges the two paths into a single code path. As a result, we'll reduce the overhead by eliminating a redundant visit to subexpressions. The change is mostly NFC (No Functional Change). The only notable difference is that when a subexpression is visited due to either lifetimebound or GSL, we will prioritize the lifetimebound path. This means the final diagnostic will be -Wdangling (rather than both `-Wdangling` and `-Wdangling-gsl`) This might cause a slight change in behavior if the -Wdangling diagnostic is disabled, but I think this is not a major concern since both diagnostics are enabled by default. Fixes llvm#93386
1 parent fab515c commit c368a72

File tree

3 files changed

+112
-149
lines changed

3 files changed

+112
-149
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ Improvements to Clang's diagnostics
239239

240240
- Clang now diagnoses when the result of a [[nodiscard]] function is discarded after being cast in C. Fixes #GH104391.
241241

242+
- Don't emit duplicated dangling diagnostics. (#GH93386).
243+
242244
Improvements to Clang's time-trace
243245
----------------------------------
244246

0 commit comments

Comments
 (0)