class Function

Declaration

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

Description

Bytecode function. Contains links to the bytecode of the function, as well as metadata describing all arguments and stack-local variables.

Declared at: clang/lib/AST/Interp/Function.h:59

Member Variables

private clang::interp::Program& P
Program reference.
private clang::SourceLocation Loc
Location of the executed code.
private const clang::FunctionDecl* F
Declaration this function was compiled from.
private unsigned int FrameSize
Local area size: storage + metadata.
private unsigned int ArgSize
Size of the argument stack.
private std::vector<char> Code
Program code.
private clang::interp::SourceMap SrcMap
Opcode-to-expression mapping.
private llvm::SmallVector<Scope, 2> Scopes
List of block descriptors.
private llvm::SmallVector<PrimType, 8> ParamTypes
List of argument types.
private llvm::DenseMap<unsigned int, ParamDescriptor> Params
Map from byte offset to parameter descriptor.
private bool IsValid = false
Flag to indicate if the function is valid.

Method Overview

  • private Function(clang::interp::Program & P, const clang::FunctionDecl * F, unsigned int ArgSize, llvm::SmallVector<PrimType, 8> && ParamTypes, llvm::DenseMap<unsigned int, ParamDescriptor> && Params)
  • public llvm::iterator_range<arg_reverse_iterator> args_reverse()
  • public void dump(llvm::raw_ostream & OS) const
  • public void dump() const
  • public unsigned int getArgSize() const
  • public clang::interp::CodePtr getCodeBegin() const
  • public clang::interp::CodePtr getCodeEnd() const
  • public const clang::FunctionDecl * getDecl() const
  • public unsigned int getFrameSize() const
  • public clang::SourceLocation getLoc() const
  • public clang::interp::Function::ParamDescriptor getParamDescriptor(unsigned int Offset) const
  • public clang::interp::Scope & getScope(unsigned int Idx)
  • public clang::interp::SourceInfo getSource(clang::interp::CodePtr PC) const
  • public bool hasRVO() const
  • public bool isConstexpr() const
  • public bool isConstructor() const
  • public bool isVirtual() const
  • public llvm::iterator_range<llvm::SmallVector<Scope, 2>::iterator> scopes()
  • private void setCode(unsigned int NewFrameSize, std::vector<char> && NewCode, clang::interp::SourceMap && NewSrcMap, llvm::SmallVector<Scope, 2> && NewScopes)

Methods

Function(
    clang::interp::Program& P,
    const clang::FunctionDecl* F,
    unsigned int ArgSize,
    llvm::SmallVector<PrimType, 8>&& ParamTypes,
    llvm::DenseMap<unsigned int,
                   ParamDescriptor>&& Params)

Description

Construct a function representing an actual function.

Declared at: clang/lib/AST/Interp/Function.h:113

Parameters

clang::interp::Program& P
const clang::FunctionDecl* F
unsigned int ArgSize
llvm::SmallVector<PrimType, 8>&& ParamTypes
llvm::DenseMap<unsigned int, ParamDescriptor>&& Params

llvm::iterator_range<arg_reverse_iterator>
args_reverse()

Declared at: clang/lib/AST/Interp/Function.h:92

void dump(llvm::raw_ostream& OS) const

Declared at: clang/lib/AST/Interp/Function.h:157

Parameters

llvm::raw_ostream& OS

void dump() const

Description

Dumps the disassembled bytecode to \c llvm::errs().

Declared at: clang/lib/AST/Interp/Function.h:156

unsigned int getArgSize() const

Description

Returns the size of the argument stackx

Declared at: clang/lib/AST/Interp/Function.h:66

clang::interp::CodePtr getCodeBegin() const

Description

Returns a pointer to the start of the code.

Declared at: clang/lib/AST/Interp/Function.h:69

clang::interp::CodePtr getCodeEnd() const

Description

Returns a pointer to the end of the code.

Declared at: clang/lib/AST/Interp/Function.h:71

const clang::FunctionDecl* getDecl() const

Description

Returns the original FunctionDecl.

Declared at: clang/lib/AST/Interp/Function.h:74

unsigned int getFrameSize() const

Description

Returns the size of the function's local stack.

Declared at: clang/lib/AST/Interp/Function.h:64

clang::SourceLocation getLoc() const

Description

Returns the location.

Declared at: clang/lib/AST/Interp/Function.h:77

clang::interp::Function::ParamDescriptor
getParamDescriptor(unsigned int Offset) const

Description

Returns a parameter descriptor.

Declared at: clang/lib/AST/Interp/Function.h:80

Parameters

unsigned int Offset

clang::interp::Scope& getScope(unsigned int Idx)

Description

Returns a specific scope.

Declared at: clang/lib/AST/Interp/Function.h:97

Parameters

unsigned int Idx

clang::interp::SourceInfo getSource(
    clang::interp::CodePtr PC) const

Description

Returns the source information at a given PC.

Declared at: clang/lib/AST/Interp/Function.h:100

Parameters

clang::interp::CodePtr PC

bool hasRVO() const

Description

Checks if the first argument is a RVO pointer.

Declared at: clang/lib/AST/Interp/Function.h:83

bool isConstexpr() const

Description

Checks if the function is valid to call in constexpr.

Declared at: clang/lib/AST/Interp/Function.h:103

bool isConstructor() const

Description

Checks if the function is a constructor.

Declared at: clang/lib/AST/Interp/Function.h:109

bool isVirtual() const

Description

Checks if the function is virtual.

Declared at: clang/lib/AST/Interp/Function.h:106

llvm::iterator_range<
    llvm::SmallVector<Scope, 2>::iterator>
scopes()

Description

Range over the scope blocks.

Declared at: clang/lib/AST/Interp/Function.h:86

void setCode(
    unsigned int NewFrameSize,
    std::vector<char>&& NewCode,
    clang::interp::SourceMap&& NewSrcMap,
    llvm::SmallVector<Scope, 2>&& NewScopes)

Description

Sets the code of a function.

Declared at: clang/lib/AST/Interp/Function.h:118

Parameters

unsigned int NewFrameSize
std::vector<char>&& NewCode
clang::interp::SourceMap&& NewSrcMap
llvm::SmallVector<Scope, 2>&& NewScopes