clang 20.0.0git
|
A storage location for a record (struct, class, or union). More...
#include "clang/Analysis/FlowSensitive/StorageLocation.h"
Public Types | |
using | FieldToLoc = llvm::DenseMap< const ValueDecl *, StorageLocation * > |
using | SyntheticFieldMap = llvm::StringMap< StorageLocation * > |
Public Types inherited from clang::dataflow::StorageLocation | |
enum class | Kind { Scalar , Record } |
Public Member Functions | |
RecordStorageLocation (QualType Type, FieldToLoc TheChildren, SyntheticFieldMap TheSyntheticFields) | |
StorageLocation * | getChild (const ValueDecl &D) const |
Returns the child storage location for D . | |
StorageLocation & | getSyntheticField (llvm::StringRef Name) const |
Returns the storage location for the synthetic field Name . | |
llvm::iterator_range< SyntheticFieldMap::const_iterator > | synthetic_fields () const |
void | setChild (const ValueDecl &D, StorageLocation *Loc) |
Changes the child storage location for a field D of reference type. | |
llvm::iterator_range< FieldToLoc::const_iterator > | children () const |
Public Member Functions inherited from clang::dataflow::StorageLocation | |
StorageLocation (Kind LocKind, QualType Type) | |
StorageLocation (const StorageLocation &)=delete | |
StorageLocation & | operator= (const StorageLocation &)=delete |
virtual | ~StorageLocation ()=default |
Kind | getKind () const |
QualType | getType () const |
Static Public Member Functions | |
static bool | classof (const StorageLocation *Loc) |
A storage location for a record (struct, class, or union).
Contains storage locations for all modeled fields of the record (also referred to as "children"). The child map is flat, so accessible members of the base class are directly accessible as children of this location.
Record storage locations may also contain so-called synthetic fields. These are typically used to model the internal state of a class (e.g. the value stored in a std::optional
) without having to depend on that class's implementation details. All RecordStorageLocation
s of a given type should have the same synthetic fields.
The storage location for a field of reference type may be null. This typically occurs in one of two situations:
FIXME: Currently, the storage location of unions is modelled the same way as that of structs or classes. Eventually, we need to change this modelling so that all of the members of a given union have the same storage location.
Definition at line 94 of file StorageLocation.h.
using clang::dataflow::RecordStorageLocation::FieldToLoc = llvm::DenseMap<const ValueDecl *, StorageLocation *> |
Definition at line 96 of file StorageLocation.h.
using clang::dataflow::RecordStorageLocation::SyntheticFieldMap = llvm::StringMap<StorageLocation *> |
Definition at line 97 of file StorageLocation.h.
|
inline |
Definition at line 99 of file StorageLocation.h.
References clang::Type::isRecordType(), and Loc.
|
inline |
Definition at line 167 of file StorageLocation.h.
Referenced by clang::dataflow::copyRecord(), and clang::dataflow::recordsEqual().
|
inlinestatic |
Definition at line 114 of file StorageLocation.h.
References Loc, and clang::dataflow::StorageLocation::Record.
|
inline |
Returns the child storage location for D
.
May return null if D
has reference type; guaranteed to return non-null in all other cases.
Note that it is an error to call this with a field that does not exist. The function does not return null in this case.
Definition at line 125 of file StorageLocation.h.
References D.
Referenced by clang::dataflow::builtinTransferInitializer(), clang::dataflow::copyRecord(), and clang::dataflow::recordsEqual().
|
inline |
Returns the storage location for the synthetic field Name
.
The synthetic field must exist.
Definition at line 144 of file StorageLocation.h.
References Loc.
Referenced by clang::dataflow::copyRecord(), and clang::dataflow::recordsEqual().
|
inline |
Changes the child storage location for a field D
of reference type.
All other fields cannot change their storage location and always retain the storage location passed to the RecordStorageLocation
constructor.
Requirements:
D
must have reference type.
Definition at line 162 of file StorageLocation.h.
Referenced by clang::dataflow::builtinTransferInitializer(), and clang::dataflow::copyField().
|
inline |
Definition at line 151 of file StorageLocation.h.
Referenced by clang::dataflow::copyRecord(), and clang::dataflow::recordsEqual().