9#ifndef LLVM_CLANG_AST_INTERP_MEMBER_POINTER_H
10#define LLVM_CLANG_AST_INTERP_MEMBER_POINTER_H
22class MemberPointer final {
26 int32_t PtrOffset = 0;
29 : Base(Base), Dcl(Dcl), PtrOffset(PtrOffset) {}
46 "getIntegerRepresentation() shouldn't be reachable for MemberPointers");
57 return static_cast<uint64_t
>(PtrOffset) <= Base.getByteOffset();
62 return Base.
atField(-PtrOffset);
66 return isa_and_nonnull<CXXMethodDecl>(Dcl);
69 return dyn_cast_if_present<CXXMethodDecl>(Dcl);
72 return dyn_cast_if_present<FieldDecl>(Dcl);
85 assert(this->Base.
isZero());
91 bool isZero()
const {
return Base.isZero() && !Dcl; }
92 bool hasBase()
const {
return !Base.isZero(); }
99 void print(llvm::raw_ostream &OS)
const {
100 OS <<
"MemberPtr(" << Base <<
" " << (
const void *)Dcl <<
" + " << PtrOffset
109 if (this->Dcl == RHS.Dcl)
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
std::string getAsString(const ASTContext &Ctx, QualType Ty) const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Represents a static or instance method of a struct/union/class.
Represents a member of a struct/union/class.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Holds all information required to evaluate constexpr code in a module.
const ValueDecl * getDecl() const
APValue toAPValue(const ASTContext &) const
uint64_t getIntegerRepresentation() const
MemberPointer takeInstance(Pointer Instance) const
std::string toDiagnosticString(const ASTContext &Ctx) const
MemberPointer(uint32_t Address, const Descriptor *D)
bool isMemberFunctionPointer() const
MemberPointer(const ValueDecl *D)
const FieldDecl * getField() const
void print(llvm::raw_ostream &OS) const
MemberPointer atInstanceBase(unsigned Offset) const
ComparisonCategoryResult compare(const MemberPointer &RHS) const
FunctionPointer toFunctionPointer(const Context &Ctx) const
const CXXMethodDecl * getMemberFunction() const
std::optional< Pointer > toPointer(const Context &Ctx) const
bool isBaseCastPossible() const
MemberPointer(Pointer Base, const ValueDecl *Dcl)
A pointer to a memory block, live or dead.
Pointer atFieldSub(unsigned Off) const
Subtract the given offset from the current Base and Offset of the pointer.
Pointer atField(unsigned Off) const
Creates a pointer to a field.
bool isZero() const
Checks if the pointer is null.
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const Boolean &B)
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
ComparisonCategoryResult
An enumeration representing the possible results of a three-way comparison.
Describes a memory block created by an allocation site.