|
clang 24.0.0git
|
#include "InterpHelpers.h"#include "Pointer.h"#include "Record.h"#include "clang/AST/RecordLayout.h"Go to the source code of this file.
Namespaces | |
| namespace | clang |
| Top level wrappers for InstallAPI frontend operations. | |
| namespace | clang::interp |
Enumerations | |
| enum | : uint8_t { Regular = 1 << 0 , IgnoreBaseCasts = 1 << 1 , SurroundingArray = 1 << 2 } |
Functions | |
| static bool | validType (QualType T) |
| static QualType | computeFieldType (const ASTContext &ASTCtx, const OpaquePointer &OP, unsigned TypeModifier=0) |
| static std::optional< unsigned > | computeFullDescSize (const ASTContext &ASTCtx, const Descriptor *Desc) |
| static unsigned | computePointerOffset (const ASTContext &ASTCtx, const Pointer &Ptr) |
Compute the byte offset of Ptr in the full declaration. | |
| static bool | pointsToLastObject (const Pointer &Ptr) |
| Does Ptr point to the last subobject? | |
| static bool | isUserWritingOffTheEnd (const ASTContext &Ctx, const Pointer &Ptr, bool InvalidBase) |
| Does Ptr point to the last object AND to a flexible array member? | |
| static bool | isUserWritingOffTheEnd (const ASTContext &ASTCtx, const OpaquePointer &OP) |
| static std::optional< uint64_t > | computeOpaquePtrOffset (const ASTContext &ASTCtx, const Pointer &Ptr, bool UseClosestSurroundingVariable, bool &OffsetIsNegative) |
| Determine the offset of the given pointer. | |
| static bool | pointsToCompleteObject (const ASTContext &ASTCtx, const Pointer &Ptr) |
| Check if the given pointer points to the complete object, i.e. | |
| static std::optional< unsigned > | computeOpaqueSize (const ASTContext &ASTCtx, const Pointer &Ptr, bool UseClosestSurroundingVariable, bool WritingOffTheEnd, bool DetermineForCompleteObject) |
| UnsignedOrNone | clang::interp::evaluateBuiltinObjectSize (const ASTContext &ASTCtx, unsigned Kind, Pointer &Ptr, const Expr *E, bool IsDynamic) |
| Evaluate __builtin_object_size or __builtin_dynamic_object_size for the given pointer and Kind. | |
| anonymous enum : uint8_t |
| Enumerator | |
|---|---|
| Regular | |
| IgnoreBaseCasts | |
| SurroundingArray | |
Definition at line 20 of file InterpBuiltinObjectSize.cpp.
|
static |
Definition at line 34 of file InterpBuiltinObjectSize.cpp.
References clang::interp::PointerPathEntry::Array, clang::interp::PointerPathEntry::Base, clang::interp::PointerPathEntry::Field, clang::Type::getAsArrayTypeUnsafe(), clang::ASTContext::getCanonicalTagType(), clang::ArrayType::getElementType(), clang::interp::OpaquePointer::getObjectType(), IgnoreBaseCasts, clang::Type::isArrayType(), clang::interp::PointerPathEntry::NegativeArray, clang::interp::OpaquePointer::path(), clang::interp::OpaquePointer::PathLength, and SurroundingArray.
Referenced by computeOpaqueSize(), and pointsToCompleteObject().
|
static |
Definition at line 67 of file InterpBuiltinObjectSize.cpp.
References clang::interp::Descriptor::ElemRecord, clang::ASTContext::getCanonicalTagType(), clang::interp::Record::getDecl(), clang::CharUnits::getQuantity(), clang::interp::Descriptor::getType(), clang::ASTContext::getTypeSizeInChars(), ASTContext::hasLayout(), clang::interp::Descriptor::isArray(), clang::interp::Descriptor::isPrimitive(), clang::interp::Descriptor::isRecord(), clang::T, and clang::interp::validType().
Referenced by clang::interp::evaluateBuiltinObjectSize().
|
static |
Determine the offset of the given pointer.
Depending on UseClosestSurroundingVariable, the offset is either relative to the full object or to the closest surrounding field or array.
Definition at line 226 of file InterpBuiltinObjectSize.cpp.
References clang::interp::Add(), clang::interp::PointerPathEntry::Array, clang::interp::PointerPathEntry::Base, clang::interp::PointerPathEntry::Field, clang::Type::getAsArrayTypeUnsafe(), clang::Type::getAsRecordDecl(), clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getBaseClassOffset(), clang::ASTContext::getCanonicalTagType(), clang::ArrayType::getElementType(), clang::FieldDecl::getFieldIndex(), clang::ASTRecordLayout::getFieldOffset(), clang::QualType::getNonReferenceType(), clang::interp::OpaquePointer::getObjectType(), clang::FieldDecl::getParent(), clang::CharUnits::getQuantity(), clang::ValueDecl::getType(), clang::ASTContext::getTypeSizeInChars(), ASTContext::hasLayout(), clang::isa(), clang::Type::isArrayType(), clang::Type::isFunctionType(), clang::Type::isIncompleteType(), clang::interp::PointerPathEntry::NegativeArray, clang::interp::OpaquePointer::path(), clang::interp::OpaquePointer::PathLength, clang::ASTContext::toCharUnitsFromBits(), and clang::interp::validType().
Referenced by clang::interp::evaluateBuiltinObjectSize().
|
static |
Definition at line 329 of file InterpBuiltinObjectSize.cpp.
References clang::interp::OpaquePointer::Base, computeFieldType(), clang::interp::OpaquePointer::getObjectType(), clang::CharUnits::getQuantity(), clang::ASTContext::getTypeSizeInChars(), IgnoreBaseCasts, clang::isa(), SurroundingArray, and clang::interp::validType().
Referenced by clang::interp::evaluateBuiltinObjectSize().
|
static |
Compute the byte offset of Ptr in the full declaration.
Definition at line 92 of file InterpBuiltinObjectSize.cpp.
Referenced by clang::interp::evaluateBuiltinObjectSize().
|
static |
Definition at line 153 of file InterpBuiltinObjectSize.cpp.
References clang::interp::PointerPathEntry::Array, clang::interp::PointerPathEntry::Base, clang::interp::PointerPathEntry::FD, clang::interp::PointerPathEntry::Field, clang::Type::getAsArrayTypeUnsafe(), clang::FieldDecl::getFieldIndex(), clang::ASTContext::getLangOpts(), clang::RecordDecl::getNumFields(), clang::interp::OpaquePointer::getObjectType(), clang::FieldDecl::getParent(), clang::ValueDecl::getType(), clang::interp::PointerPathEntry::Index, clang::isa(), clang::Type::isArrayType(), clang::TagDecl::isUnion(), clang::interp::PointerPathEntry::Kind, clang::interp::PointerPathEntry::NegativeArray, clang::interp::OpaquePointer::Path, and clang::interp::OpaquePointer::PathLength.
|
static |
Does Ptr point to the last object AND to a flexible array member?
Definition at line 126 of file InterpBuiltinObjectSize.cpp.
References clang::ASTContext::getLangOpts(), clang::interp::Descriptor::isArray(), and pointsToLastObject().
Referenced by determineEndOffset(), and clang::interp::evaluateBuiltinObjectSize().
|
static |
Check if the given pointer points to the complete object, i.e.
either to the very beginning or after the end (into the flexible array member) of the object.
Definition at line 316 of file InterpBuiltinObjectSize.cpp.
References computeFieldType(), clang::interp::OpaquePointer::getSurroundingArray(), clang::isa(), clang::interp::OpaquePointer::isArrayElement(), and clang::interp::OpaquePointer::PathLength.
Referenced by clang::interp::evaluateBuiltinObjectSize().
Does Ptr point to the last subobject?
Definition at line 98 of file InterpBuiltinObjectSize.cpp.
References clang::interp::Pointer::expand(), clang::interp::Pointer::getArray(), clang::interp::Pointer::getBase(), clang::interp::Pointer::getField(), clang::FieldDecl::getFieldIndex(), clang::interp::Record::getNumFields(), clang::interp::Pointer::getRecord(), clang::interp::Pointer::isArrayElement(), clang::interp::Pointer::isBaseClass(), and clang::interp::Pointer::isRoot().
Referenced by isUserWritingOffTheEnd().
Definition at line 28 of file InterpBuiltinObjectSize.cpp.
References ASTContext::hasLayout(), and clang::T.