20 llvm::DenseMap<unsigned, ParamDescriptor> &&Params,
22 bool HasThisPointer,
bool HasRVO,
bool IsLambdaStaticInvoker)
23 : P(P), Kind(FunctionKind::
Normal), Source(Source), ArgSize(ArgSize),
24 ParamTypes(
std::move(ParamTypes)), Params(
std::move(Params)),
25 ParamOffsets(
std::move(ParamOffsets)), IsValid(
false),
26 IsFullyCompiled(
false), HasThisPointer(HasThisPointer), HasRVO(HasRVO),
28 if (
const auto *F = dyn_cast<const FunctionDecl *>(Source)) {
29 Variadic = F->isVariadic();
31 Constexpr = F->isConstexpr() || F->hasAttr<MSConstexprAttr>();
32 if (
const auto *CD = dyn_cast<CXXConstructorDecl>(F)) {
34 Kind = FunctionKind::Ctor;
35 }
else if (
const auto *CD = dyn_cast<CXXDestructorDecl>(F)) {
37 Kind = FunctionKind::Dtor;
38 }
else if (
const auto *MD = dyn_cast<CXXMethodDecl>(F)) {
40 if (IsLambdaStaticInvoker)
41 Kind = FunctionKind::LambdaStaticInvoker;
43 Kind = FunctionKind::LambdaCallOperator;
44 else if (MD->isCopyAssignmentOperator() || MD->isMoveAssignmentOperator())
45 Kind = FunctionKind::CopyOrMoveOperator;
58 auto It = Params.find(Offset);
59 assert(It != Params.end() &&
"Invalid parameter offset");
64 assert(PC >=
getCodeBegin() &&
"PC does not belong to this function");
65 assert(PC <=
getCodeEnd() &&
"PC Does not belong to this function");
66 assert(
hasBody() &&
"Function has no body");
68 using Elem = std::pair<unsigned, SourceInfo>;
69 auto It = llvm::lower_bound(SrcMap, Elem{Offset, {}}, llvm::less_first());
70 if (It == SrcMap.end())
71 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.
std::pair< PrimType, Descriptor * > ParamDescriptor
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)