clang 22.0.0git
clang::ConstructionContextLayer Class Reference

Construction context can be seen as a linked list of multiple layers. More...

#include "clang/Analysis/ConstructionContext.h"

Public Member Functions

const ConstructionContextItemgetItem () const
const ConstructionContextLayergetParent () const
bool isLast () const
bool isStrictlyMoreSpecificThan (const ConstructionContextLayer *Other) const
 See if Other is a proper initial segment of this construction context in terms of the parent chain - i.e.

Static Public Member Functions

static const ConstructionContextLayercreate (BumpVectorContext &C, const ConstructionContextItem &Item, const ConstructionContextLayer *Parent=nullptr)

Detailed Description

Construction context can be seen as a linked list of multiple layers.

Sometimes a single trigger is not enough to describe the construction site. That's what causing us to have a chain of "partial" construction context layers. Some examples:

  • A constructor within in an aggregate initializer list within a variable would have a construction context of the initializer list with the parent construction context of a variable.
  • A constructor for a temporary that needs to be both destroyed and materialized into an elidable copy constructor would have a construction context of a CXXBindTemporaryExpr with the parent construction context of a MaterializeTemproraryExpr. Not all of these are currently supported. Layers are created gradually while traversing the AST, and layers that represent the outmost AST nodes are built first, while the node that immediately contains the constructor would be built last and capture the previous layers as its parents. Construction context captures the last layer (which has links to the previous layers) and classifies the seemingly arbitrary chain of layers into one of the possible ways of constructing an object in C++ for user-friendly experience.

Definition at line 213 of file ConstructionContext.h.

Member Function Documentation

◆ create()

const ConstructionContextLayer * ConstructionContextLayer::create ( BumpVectorContext & C,
const ConstructionContextItem & Item,
const ConstructionContextLayer * Parent = nullptr )
static

Definition at line 22 of file ConstructionContext.cpp.

References clang::C.

◆ getItem()

const ConstructionContextItem & clang::ConstructionContextLayer::getItem ( ) const
inline

Definition at line 226 of file ConstructionContext.h.

Referenced by clang::ConstructionContext::createFromLayers().

◆ getParent()

const ConstructionContextLayer * clang::ConstructionContextLayer::getParent ( ) const
inline

Definition at line 227 of file ConstructionContext.h.

Referenced by clang::ConstructionContext::createFromLayers().

◆ isLast()

bool clang::ConstructionContextLayer::isLast ( ) const
inline

Definition at line 228 of file ConstructionContext.h.

Referenced by clang::ConstructionContext::createFromLayers().

◆ isStrictlyMoreSpecificThan()

bool ConstructionContextLayer::isStrictlyMoreSpecificThan ( const ConstructionContextLayer * Other) const

See if Other is a proper initial segment of this construction context in terms of the parent chain - i.e.

a few first parents coincide and then the other context terminates but our context goes further - i.e., we are providing the same context that the other context provides, and a bit more above that.

Definition at line 30 of file ConstructionContext.cpp.

References clang::Other, and clang::Self.


The documentation for this class was generated from the following files: