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"
90 using FieldToLoc = llvm::DenseMap<const ValueDecl *, StorageLocation *>;
97 assert(!
Type.isNull());
100 for (
auto [Field, Loc] : Children) {
101 if (!Field->getType()->isReferenceType() && Loc ==
nullptr)
120 auto It = Children.find(&D);
122 if (It == Children.end()) {
123 llvm::dbgs() <<
"Couldn't find child " << D.getNameAsString()
124 <<
" on StorageLocation " << this <<
" of type "
125 << getType() <<
"\n";
126 llvm::dbgs() <<
"Existing children:\n";
127 for ([[maybe_unused]] auto [Field, Loc] : Children) {
128 llvm::dbgs() << Field->getNameAsString() <<
"\n";
132 assert(It != Children.end());
148 llvm::iterator_range<FieldToLoc::const_iterator>
children()
const {
149 return {Children.begin(), Children.end()};
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).
StorageLocation * getChild(const ValueDecl &D) const
Returns the child storage location for D.
RecordStorageLocation(QualType Type, FieldToLoc TheChildren)
llvm::DenseMap< const ValueDecl *, StorageLocation * > FieldToLoc
void setChild(const ValueDecl &D, StorageLocation *Loc)
Changes the child storage location for a field D of reference type.
RecordStorageLocation(QualType Type)
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