[PATCH] D140020: [clang][dataflow] Improve optional model's support for ignoring smart pointers.

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 14 06:08:29 PST 2022


ymandel created this revision.
ymandel added a reviewer: xazax.hun.
Herald added subscribers: martong, rnkovacs.
Herald added a reviewer: NoQ.
Herald added a project: All.
ymandel requested review of this revision.
Herald added a project: clang.

The optional model has an option to ignore optionals accessed through smart
pointer types (other than optional itself). This patch improves this feature in
two ways:

1. We extend support to optionals accessed directly through the smart pointer,

like `ptr->value()`. Previously, support was limited to cases that went through
an intermediate field.

2. We clean up the implementation by removing the option from the analysis,

leaving it only in the diagnostic phase (where it is relevant).

3. Adjusts a test which was misleading in what it was testing.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140020

Files:
  clang/include/clang/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.h
  clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
  clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140020.482830.patch
Type: text/x-patch
Size: 8690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221214/54fa99cc/attachment.bin>


More information about the cfe-commits mailing list