[all-commits] [llvm/llvm-project] 72a28a: [clang][dataflow] Use smart pointer caching in unc...

Jan Voung via All-commits all-commits at lists.llvm.org
Wed Jan 8 05:27:38 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 72a28a3bf0b539bcdfd8f41905675ce6a890c0ac
      https://github.com/llvm/llvm-project/commit/72a28a3bf0b539bcdfd8f41905675ce6a890c0ac
  Author: Jan Voung <jvoung at google.com>
  Date:   2025-01-08 (Wed, 08 Jan 2025)

  Changed paths:
    M clang/include/clang/Analysis/FlowSensitive/CachedConstAccessorsLattice.h
    M clang/include/clang/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.h
    M clang/include/clang/Analysis/FlowSensitive/SmartPointerAccessorCaching.h
    M clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
    M clang/lib/Analysis/FlowSensitive/SmartPointerAccessorCaching.cpp
    M clang/unittests/Analysis/FlowSensitive/CachedConstAccessorsLatticeTest.cpp
    M clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp

  Log Message:
  -----------
  [clang][dataflow] Use smart pointer caching in unchecked optional accessor (#120249)

Part 2 (and final part) following
https://github.com/llvm/llvm-project/pull/120102
Allows users to do things like:

```
if (o->x.has_value()) {
  ((*o).x).value();
}
```
where the `->` and `*` are operator overload calls.

A user could instead extract the nested optional into a local variable
once instead of doing two accessor calls back to back, but currently
they are unsure why the code is flagged.



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