[all-commits] [llvm/llvm-project] c368a7: [clang] Merge lifetimebound and GSL code paths for...

Haojian Wu via All-commits all-commits at lists.llvm.org
Thu Aug 22 01:36:11 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c368a720a0b40bb8fe4aff3971fe9a7009c85aa6
      https://github.com/llvm/llvm-project/commit/c368a720a0b40bb8fe4aff3971fe9a7009c85aa6
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2024-08-22 (Thu, 22 Aug 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/CheckExprLifetime.cpp
    M clang/test/Sema/warn-lifetime-analysis-nocfg.cpp

  Log Message:
  -----------
  [clang] Merge lifetimebound and GSL code paths for lifetime analysis (#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 #93386



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list