;
41llvm_unreachable(
"The above loop can only be terminated via return!");
45ConstructionContext::createMaterializedTemporaryFromLayers(
72assert(ElidedItem.
getKind() ==
74ElidedCE = cast<CXXConstructExpr>(ElidedItem.
getStmt());
84 returncreate<SimpleTemporaryObjectConstructionContext>(
C, BTE, MTE);
86 returncreate<ElidedTemporaryObjectConstructionContext>(
87 C, BTE, MTE, ElidedCE, ElidedCC);
92 returncreate<SimpleTemporaryObjectConstructionContext>(
C, BTE, MTE);
103 returncreate<SimpleTemporaryObjectConstructionContext>(
C, BTE,
108 switch(ParentItem.
getKind()) {
110 const auto*DS = cast<DeclStmt>(ParentItem.
getStmt());
111assert(!cast<VarDecl>(DS->getSingleDecl())->getType().getCanonicalType()
112->getAsCXXRecordDecl()->hasTrivialDestructor());
113 returncreate<CXX17ElidedCopyVariableConstructionContext>(
C, DS, BTE);
116llvm_unreachable(
"This context does not accept a bound temporary!");
119assert(ParentLayer->
isLast());
120 const auto*RS = cast<ReturnStmt>(ParentItem.
getStmt());
121assert(!RS->getRetValue()->getType().getCanonicalType()
122->getAsCXXRecordDecl()->hasTrivialDestructor());
123 returncreate<CXX17ElidedCopyReturnedValueConstructionContext>(
C, RS,
129 const auto*MTE = cast<MaterializeTemporaryExpr>(ParentItem.
getStmt());
130 returncreateMaterializedTemporaryFromLayers(
C, MTE, BTE,
134llvm_unreachable(
"Duplicate CXXBindTemporaryExpr in the AST!");
137llvm_unreachable(
"Elided destructor items are not produced by the CFG!");
140llvm_unreachable(
"Materialization is necessary to put temporary into a " 141 "copy or move constructor!");
144assert(ParentLayer->
isLast());
145 const auto*
E= cast<Expr>(ParentItem.
getStmt());
146assert(isa<CallExpr>(
E) || isa<CXXConstructExpr>(
E) ||
147isa<ObjCMessageExpr>(
E));
148 returncreate<ArgumentConstructionContext>(
C,
E, ParentItem.
getIndex(),
152assert(ParentLayer->
isLast());
154assert(!I->getAnyMember()->getType().getCanonicalType()
155->getAsCXXRecordDecl()->hasTrivialDestructor());
156 returncreate<CXX17ElidedCopyConstructorInitializerConstructionContext>(
160assert(ParentLayer->
isLast());
161 const auto*
E= cast<LambdaExpr>(ParentItem.
getStmt());
162 returncreate<LambdaCaptureConstructionContext>(
C,
E,
167llvm_unreachable(
"Unexpected construction context with destructor!");
178assert(TopLayer->
isLast());
179 const auto*DS = cast<DeclStmt>(TopItem.
getStmt());
180 returncreate<SimpleVariableConstructionContext>(
C, DS);
183assert(TopLayer->
isLast());
184 const auto*NE = cast<CXXNewExpr>(TopItem.
getStmt());
185 returncreate<NewAllocatedObjectConstructionContext>(
C, NE);
188assert(TopLayer->
isLast());
189 const auto*RS = cast<ReturnStmt>(TopItem.
getStmt());
190 returncreate<SimpleReturnedValueConstructionContext>(
C, RS);
193 const auto*MTE = cast<MaterializeTemporaryExpr>(TopItem.
getStmt());
194 returncreateMaterializedTemporaryFromLayers(
C, MTE,
nullptr,
198 const auto*BTE = cast<CXXBindTemporaryExpr>(TopItem.
getStmt());
201 returncreateBoundTemporaryFromLayers(
C, BTE, TopLayer->
getParent());
204llvm_unreachable(
"Elided destructor items are not produced by the CFG!");
207llvm_unreachable(
"The argument needs to be materialized first!");
210assert(TopLayer->
isLast());
211 const auto*
E= cast<LambdaExpr>(TopItem.
getStmt());
212 returncreate<LambdaCaptureConstructionContext>(
C,
E, TopItem.
getIndex());
215assert(TopLayer->
isLast());
217 returncreate<SimpleConstructorInitializerConstructionContext>(
C, I);
220assert(TopLayer->
isLast());
221 const auto*
E= cast<Expr>(TopItem.
getStmt());
222 returncreate<ArgumentConstructionContext>(
C,
E, TopItem.
getIndex(),
226llvm_unreachable(
"Unexpected construction context!");
Represents binding an expression to a temporary.
Represents a call to a C++ constructor.
bool isElidable() const
Whether this construction is elidable.
Represents a C++ base or member initializer.
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
bool hasNonTrivialDestructor() const
Determine whether this class has a non-trivial destructor (C++ [class.dtor]p3)
Represents a single point (AST node) in the program that requires attention during construction of an...
unsigned getIndex() const
If a single trigger statement triggers multiple constructors, they are usually being enumerated.
const CXXCtorInitializer * getCXXCtorInitializer() const
The construction site is not necessarily a statement.
@ TemporaryDestructorKind
@ ElidableConstructorKind
const Stmt * getStmt() const
The construction site - the statement that triggered the construction for one of its parts.
Construction context can be seen as a linked list of multiple layers.
static const ConstructionContextLayer * create(BumpVectorContext &C, const ConstructionContextItem &Item, const ConstructionContextLayer *Parent=nullptr)
const ConstructionContextItem & getItem() const
const ConstructionContextLayer * getParent() 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 - ...
ConstructionContext's subclasses describe different ways of constructing an object in C++.
static const ConstructionContext * createFromLayers(BumpVectorContext &C, const ConstructionContextLayer *TopLayer)
Consume the construction context layer, together with its parent layers, and wrap it up into a comple...
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
QualType getCanonicalType() const
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
The JSON file list parser is used to communicate input to InstallAPI.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ SD_FullExpression
Full-expression storage duration (for temporaries).
@ Other
Other implicit parameter.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4