20 bool HasThisPointer,
bool HasRVO,
bool IsLambdaStaticInvoker)
21 : P(P), Kind(FunctionKind::
Normal), Source(Source), ArgSize(ArgSize),
22 ParamDescriptors(
std::move(ParamDescriptors)), IsValid(
false),
23 IsFullyCompiled(
false), HasThisPointer(HasThisPointer), HasRVO(HasRVO),
25 for (ParamDescriptor PD : this->ParamDescriptors) {
26 Params.insert({PD.Offset, PD});
28 assert(Params.size() == this->ParamDescriptors.size());
30 if (
const auto *F = dyn_cast<const FunctionDecl *>(Source)) {
31 Variadic = F->isVariadic();
34 if (
const auto *CD = dyn_cast<CXXConstructorDecl>(F)) {
36 Kind = FunctionKind::Ctor;
37 }
else if (
const auto *CD = dyn_cast<CXXDestructorDecl>(F)) {
39 Kind = FunctionKind::Dtor;
40 }
else if (
const auto *MD = dyn_cast<CXXMethodDecl>(F)) {
42 if (IsLambdaStaticInvoker)
43 Kind = FunctionKind::LambdaStaticInvoker;
45 Kind = FunctionKind::LambdaCallOperator;
46 else if (MD->isCopyAssignmentOperator() || MD->isMoveAssignmentOperator())
47 Kind = FunctionKind::CopyOrMoveOperator;
60 auto It = Params.find(Offset);
61 assert(It != Params.end() &&
"Invalid parameter offset");
66 assert(PC >=
getCodeBegin() &&
"PC does not belong to this function");
67 assert(PC <=
getCodeEnd() &&
"PC Does not belong to this function");
68 assert(
hasBody() &&
"Function has no body");
70 using Elem = std::pair<unsigned, SourceInfo>;
71 auto It = llvm::lower_bound(SrcMap, Elem{Offset, {}}, llvm::less_first());
72 if (It == SrcMap.end())
73 return SrcMap.back().second;
This file provides some common utility functions for processing Lambda related AST Constructs.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Pointer into the code segment.
CodePtr getCodeBegin() const
Returns a pointer to the start of the code.
CodePtr getCodeEnd() const
Returns a pointer to the end of the code.
bool hasBody() const
Checks if the function already has a body attached.
SourceInfo getSource(CodePtr PC) const
Returns the source information at a given PC.
ParamDescriptor getParamDescriptor(unsigned Offset) const
Returns a parameter descriptor.
The program contains and links the bytecode for all functions.
Describes the statement/declaration an opcode was generated from.
llvm::PointerUnion< const FunctionDecl *, const BlockExpr * > FunctionDeclTy
The JSON file list parser is used to communicate input to InstallAPI.
bool isLambdaCallOperator(const CXXMethodDecl *MD)