14#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_STORAGELOCATION_H
15#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_STORAGELOCATION_H
19#include "llvm/ADT/DenseMap.h"
20#include "llvm/Support/Debug.h"
23#define DEBUG_TYPE "dataflow"
96 using FieldToLoc = llvm::DenseMap<const ValueDecl *, StorageLocation *>;
102 SyntheticFields(
std::move(TheSyntheticFields)) {
103 assert(!
Type.isNull());
106 for (
auto [Field,
Loc] : Children) {
107 if (!Field->getType()->isReferenceType() &&
Loc ==
nullptr)
126 auto It = Children.find(&
D);
128 if (It == Children.end()) {
129 llvm::dbgs() <<
"Couldn't find child " << D.getNameAsString()
130 <<
" on StorageLocation " << this <<
" of type "
131 << getType() <<
"\n";
132 llvm::dbgs() <<
"Existing children:\n";
133 for ([[maybe_unused]] auto [Field, Loc] : Children) {
134 llvm::dbgs() << Field->getNameAsString() <<
"\n";
138 assert(It != Children.end());
146 assert(
Loc !=
nullptr);
150 llvm::iterator_range<SyntheticFieldMap::const_iterator>
152 return {SyntheticFields.begin(), SyntheticFields.end()};
163 assert(
D.getType()->isReferenceType());
167 llvm::iterator_range<FieldToLoc::const_iterator>
children()
const {
168 return {Children.begin(), Children.end()};
173 SyntheticFieldMap SyntheticFields;
llvm::MachO::Record Record
C Language Family Type Representation.
A (possibly-)qualified type.
The base class of the type hierarchy.
bool isReferenceType() const
bool isRecordType() const
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
A storage location for a record (struct, class, or union).
llvm::iterator_range< SyntheticFieldMap::const_iterator > synthetic_fields() const
StorageLocation * getChild(const ValueDecl &D) const
Returns the child storage location for D.
llvm::DenseMap< const ValueDecl *, StorageLocation * > FieldToLoc
llvm::StringMap< StorageLocation * > SyntheticFieldMap
RecordStorageLocation(QualType Type, FieldToLoc TheChildren, SyntheticFieldMap TheSyntheticFields)
void setChild(const ValueDecl &D, StorageLocation *Loc)
Changes the child storage location for a field D of reference type.
StorageLocation & getSyntheticField(llvm::StringRef Name) const
Returns the storage location for the synthetic field Name.
static bool classof(const StorageLocation *Loc)
llvm::iterator_range< FieldToLoc::const_iterator > children() const
A storage location that is not subdivided further for the purposes of abstract interpretation.
ScalarStorageLocation(QualType Type)
static bool classof(const StorageLocation *Loc)
Base class for elements of the local variable store and of the heap.
virtual ~StorageLocation()=default
StorageLocation(Kind LocKind, QualType Type)
StorageLocation & operator=(const StorageLocation &)=delete
StorageLocation(const StorageLocation &)=delete
The JSON file list parser is used to communicate input to InstallAPI.