#include "CodeGenFunction.h"
#include "CodeGenModule.h"
#include "clang/AST/NonTrivialTypeVisitor.h"
#include "clang/CodeGen/CodeGenABITypes.h"
#include "llvm/Support/ScopedPrinter.h"
#include <array>
usingnamespaceclang;
usingnamespaceCodeGen;
static uint64_t getFieldSize(const FieldDecl *FD, QualType FT,
ASTContext &Ctx) { … }
namespace {
enum { … };
const char *ValNameStr[2] = …;
template <class Derived> struct StructVisitor { … };
template <class Derived, bool IsMove>
struct CopyStructVisitor : StructVisitor<Derived>,
CopiedTypeVisitor<Derived, IsMove> { … };
template <class Derived> struct GenFuncNameBase { … };
template <class Derived>
struct GenUnaryFuncName : StructVisitor<Derived>, GenFuncNameBase<Derived> { … };
static llvm::Constant *getNullForVariable(Address Addr) { … }
template <bool IsMove>
struct GenBinaryFuncName : CopyStructVisitor<GenBinaryFuncName<IsMove>, IsMove>,
GenFuncNameBase<GenBinaryFuncName<IsMove>> { … };
struct GenDefaultInitializeFuncName
: GenUnaryFuncName<GenDefaultInitializeFuncName>,
DefaultInitializedTypeVisitor<GenDefaultInitializeFuncName> { … };
struct GenDestructorFuncName : GenUnaryFuncName<GenDestructorFuncName>,
DestructedTypeVisitor<GenDestructorFuncName> { … };
template <size_t N>
static const CGFunctionInfo &getFunctionInfo(CodeGenModule &CGM,
FunctionArgList &Args) { … }
template <size_t N, size_t... Ints>
static std::array<Address, N> getParamAddrs(std::index_sequence<Ints...> IntSeq,
std::array<CharUnits, N> Alignments,
const FunctionArgList &Args,
CodeGenFunction *CGF) { … }
template <class Derived> struct GenFuncBase { … };
template <class Derived, bool IsMove>
struct GenBinaryFunc : CopyStructVisitor<Derived, IsMove>,
GenFuncBase<Derived> { … };
struct GenDestructor : StructVisitor<GenDestructor>,
GenFuncBase<GenDestructor>,
DestructedTypeVisitor<GenDestructor> { … };
struct GenDefaultInitialize
: StructVisitor<GenDefaultInitialize>,
GenFuncBase<GenDefaultInitialize>,
DefaultInitializedTypeVisitor<GenDefaultInitialize> { … };
struct GenCopyConstructor : GenBinaryFunc<GenCopyConstructor, false> { … };
struct GenMoveConstructor : GenBinaryFunc<GenMoveConstructor, true> { … };
struct GenCopyAssignment : GenBinaryFunc<GenCopyAssignment, false> { … };
struct GenMoveAssignment : GenBinaryFunc<GenMoveAssignment, true> { … };
}
void CodeGenFunction::destroyNonTrivialCStruct(CodeGenFunction &CGF,
Address Addr, QualType Type) { … }
void CodeGenFunction::defaultInitNonTrivialCStructVar(LValue Dst) { … }
template <class G, size_t N>
static void callSpecialFunction(G &&Gen, StringRef FuncName, QualType QT,
bool IsVolatile, CodeGenFunction &CGF,
std::array<Address, N> Addrs) { … }
template <class G, size_t N>
static llvm::Function *
getSpecialFunction(G &&Gen, StringRef FuncName, QualType QT, bool IsVolatile,
std::array<CharUnits, N> Alignments, CodeGenModule &CGM) { … }
void CodeGenFunction::callCStructDefaultConstructor(LValue Dst) { … }
std::string CodeGenFunction::getNonTrivialCopyConstructorStr(
QualType QT, CharUnits Alignment, bool IsVolatile, ASTContext &Ctx) { … }
std::string CodeGenFunction::getNonTrivialDestructorStr(QualType QT,
CharUnits Alignment,
bool IsVolatile,
ASTContext &Ctx) { … }
void CodeGenFunction::callCStructDestructor(LValue Dst) { … }
void CodeGenFunction::callCStructCopyConstructor(LValue Dst, LValue Src) { … }
void CodeGenFunction::callCStructCopyAssignmentOperator(LValue Dst, LValue Src
) { … }
void CodeGenFunction::callCStructMoveConstructor(LValue Dst, LValue Src) { … }
void CodeGenFunction::callCStructMoveAssignmentOperator(LValue Dst, LValue Src
) { … }
llvm::Function *clang::CodeGen::getNonTrivialCStructDefaultConstructor(
CodeGenModule &CGM, CharUnits DstAlignment, bool IsVolatile, QualType QT) { … }
llvm::Function *clang::CodeGen::getNonTrivialCStructCopyConstructor(
CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment,
bool IsVolatile, QualType QT) { … }
llvm::Function *clang::CodeGen::getNonTrivialCStructMoveConstructor(
CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment,
bool IsVolatile, QualType QT) { … }
llvm::Function *clang::CodeGen::getNonTrivialCStructCopyAssignmentOperator(
CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment,
bool IsVolatile, QualType QT) { … }
llvm::Function *clang::CodeGen::getNonTrivialCStructMoveAssignmentOperator(
CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment,
bool IsVolatile, QualType QT) { … }
llvm::Function *clang::CodeGen::getNonTrivialCStructDestructor(
CodeGenModule &CGM, CharUnits DstAlignment, bool IsVolatile, QualType QT) { … }