class ConstructionContextLayer

Declaration

class ConstructionContextLayer { /* full declaration omitted */ };

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.

Declared at: clang/include/clang/Analysis/ConstructionContext.h:213

Member Variables

private const clang::ConstructionContextLayer* Parent = nullptr
private clang::ConstructionContextItem Item

Method Overview

  • private ConstructionContextLayer(clang::ConstructionContextItem Item, const clang::ConstructionContextLayer * Parent)
  • public static const clang::ConstructionContextLayer * create(clang::BumpVectorContext & C, const clang::ConstructionContextItem & Item, const clang::ConstructionContextLayer * Parent = nullptr)
  • public const clang::ConstructionContextItem & getItem() const
  • public const clang::ConstructionContextLayer * getParent() const
  • public bool isLast() const
  • public bool isStrictlyMoreSpecificThan(const clang::ConstructionContextLayer * Other) const

Methods

ConstructionContextLayer(
    clang::ConstructionContextItem Item,
    const clang::ConstructionContextLayer* Parent)

Declared at: clang/include/clang/Analysis/ConstructionContext.h:217

Parameters

clang::ConstructionContextItem Item
const clang::ConstructionContextLayer* Parent

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

Declared at: clang/include/clang/Analysis/ConstructionContext.h:223

Parameters

clang::BumpVectorContext& C
const clang::ConstructionContextItem& Item
const clang::ConstructionContextLayer* Parent = nullptr

const clang::ConstructionContextItem& getItem()
    const

Declared at: clang/include/clang/Analysis/ConstructionContext.h:226

const clang::ConstructionContextLayer* getParent()
    const

Declared at: clang/include/clang/Analysis/ConstructionContext.h:227

bool isLast() const

Declared at: clang/include/clang/Analysis/ConstructionContext.h:228

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

Description

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.

Declared at: clang/include/clang/Analysis/ConstructionContext.h:235

Parameters

const clang::ConstructionContextLayer* Other