clang 23.0.0git
clang::ssaf::Comparator Struct Reference

An EntityPointerLevel represents a level of the declared pointer/array type of an entity. More...

#include "clang/ScalableStaticAnalysisFramework/Analyses/UnsafeBufferUsage/UnsafeBufferUsage.h"

Public Types

using is_transparent = void

Public Member Functions

bool operator() (const EntityPointerLevel &L, const EntityPointerLevel &R) const
bool operator() (const EntityId &L, const EntityPointerLevel &R) const
bool operator() (const EntityPointerLevel &L, const EntityId &R) const

Detailed Description

An EntityPointerLevel represents a level of the declared pointer/array type of an entity.

In the fully-expanded spelling of the declared type, a EntityPointerLevel is associated with a '*' (or a '[]‘) in that declaration. / / For example, for 'int *p[10];’, there are two EntityPointerLevels. One / is associated with 'int *[10]' of 'p' and the other is associated with 'int / *' of 'p'. / / An EntityPointerLevel can be identified by an EntityId and an unsigned / integer indicating the pointer level: '(EntityId, PointerLevel)'. / An EntityPointerLevel 'P' is valid iff 'P.EntityId' has a pointer type with / at least 'P.PointerLevel' levels (This implies 'P.PointerLevel > 0'). / / For the same example 'int *p[10];', the EntityPointerLevels below are valid: / - '(p, 2)' is associated with the 'int *' part of the declared type of 'p'; / - '(p, 1)' is associated with the 'int *[10]' part of the declared type of / 'p'. class EntityPointerLevel { EntityId Entity; unsigned PointerLevel;

friend class UnsafeBufferUsageTUSummaryExtractor;

EntityPointerLevel(EntityId Entity, unsigned PointerLevel) : Entity(Entity), PointerLevel(PointerLevel) {}

public: EntityId getEntity() const { return Entity; } unsigned getPointerLevel() const { return PointerLevel; }

bool operator==(const EntityPointerLevel &Other) const { return std::tie(Entity, PointerLevel) == std::tie(Other.Entity, Other.PointerLevel); }

bool operator!=(const EntityPointerLevel &Other) const { return !(*this == Other); }

bool operator<(const EntityPointerLevel &Other) const { return std::tie(Entity, PointerLevel) < std::tie(Other.Entity, Other.PointerLevel); }

/ Compares EntityPointerLevels; additionally, partially compares / EntityPointerLevel with EntityId.

Definition at line 65 of file UnsafeBufferUsage.h.

Member Typedef Documentation

◆ is_transparent

Definition at line 66 of file UnsafeBufferUsage.h.

Member Function Documentation

◆ operator()() [1/3]

bool clang::ssaf::Comparator::operator() ( const EntityId & L,
const EntityPointerLevel & R ) const
inline

Definition at line 71 of file UnsafeBufferUsage.h.

◆ operator()() [2/3]

bool clang::ssaf::Comparator::operator() ( const EntityPointerLevel & L,
const EntityId & R ) const
inline

Definition at line 74 of file UnsafeBufferUsage.h.

◆ operator()() [3/3]

bool clang::ssaf::Comparator::operator() ( const EntityPointerLevel & L,
const EntityPointerLevel & R ) const
inline

Definition at line 67 of file UnsafeBufferUsage.h.


The documentation for this struct was generated from the following file: