clang 20.0.0git
Public Attributes | List of all members
clang::dataflow::UncheckedOptionalAccessModelOptions Struct Reference

#include "clang/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.h"

Public Attributes

bool IgnoreSmartPointerDereference = false
 In generating diagnostics, ignore optionals reachable through overloaded operator* or operator-> (other than those of the optional type itself).
 

Detailed Description

Definition at line 33 of file UncheckedOptionalAccessModel.h.

Member Data Documentation

◆ IgnoreSmartPointerDereference

bool clang::dataflow::UncheckedOptionalAccessModelOptions::IgnoreSmartPointerDereference = false

In generating diagnostics, ignore optionals reachable through overloaded operator* or operator-> (other than those of the optional type itself).

The analysis does not equate the results of such calls, so it can't identify when their results are used safely (across calls), resulting in false positives in all such cases. Note: this option does not cover access through operator[]. FIXME: we currently cache and equate the result of const accessors returning pointers, so cover the case of operator-> followed by operator->, which covers the common case of smart pointers. We also cover some limited cases of returning references (if return type is an optional type), so cover some cases of operator* followed by operator*. We don't cover mixing operator-> and operator*. Once we are confident in this const accessor caching, we shouldn't need the IgnoreSmartPointerDereference option anymore.

Definition at line 48 of file UncheckedOptionalAccessModel.h.


The documentation for this struct was generated from the following file: