clang 8.0.0

Functions
MicrosoftCXXABI.cpp File Reference
`#include "CGCXXABI.h"`
`#include "CGCleanup.h"`
`#include "CGVTables.h"`
`#include "CodeGenModule.h"`
`#include "CodeGenTypes.h"`
`#include "TargetInfo.h"`
`#include "clang/CodeGen/ConstantInitBuilder.h"`
`#include "clang/AST/Decl.h"`
`#include "clang/AST/DeclCXX.h"`
`#include "clang/AST/StmtCXX.h"`
`#include "clang/AST/VTableBuilder.h"`
`#include "llvm/ADT/StringExtras.h"`
`#include "llvm/ADT/StringSet.h"`
`#include "llvm/IR/CallSite.h"`
`#include "llvm/IR/Intrinsics.h"`
Include dependency graph for MicrosoftCXXABI.cpp:

Go to the source code of this file.

## Functions
static llvm::CallSite | emitRTtypeidCall (CodeGenFunction &CGF, llvm::Value *Argument)
static bool | isDeletingDtor (GlobalDecl GD)
static bool | hasDefaultCXXMethodCC (ASTContext &Context, const CXXMethodDecl *MD)
static void | mangleVFTableName (MicrosoftMangleContext &MangleContext, const CXXRecordDecl *RD, const VPtrInfo &VFPtr, SmallString< 256 > &Name)
static void | emitGlobalDtorWithTLRegDtor (CodeGenFunction &CGF, const VarDecl &VD, llvm::Constant *Dtor, llvm::Constant *Addr)
static ConstantAddress | getInitThreadEpochPtr (CodeGenModule &CGM)
static llvm::Constant * | getInitThreadHeaderFn (CodeGenModule &CGM)
static llvm::Constant * | getInitThreadFooterFn (CodeGenModule &CGM)
static llvm::Constant * | getInitThreadAbortFn (CodeGenModule &CGM)
static llvm::GlobalVariable * | getTypeInfoVTable (CodeGenModule &CGM)
static void | serializeClassHierarchy (SmallVectorImpl< MSRTTIClass > &Classes, const CXXRecordDecl *RD)
| Recursively serializes a class hierarchy in pre-order depth first order. More...
static void | detectAmbiguousBases (SmallVectorImpl< MSRTTIClass > &Classes)
| Find ambiguity among base classes. More...
static QualType | decomposeTypeForEH (ASTContext &Context, QualType T, bool &IsConst, bool &IsVolatile, bool &IsUnaligned)
static void | emitCXXConstructor (CodeGenModule &CGM, const CXXConstructorDecl *ctor, StructorType ctorType)
static void | emitCXXDestructor (CodeGenModule &CGM, const CXXDestructorDecl *dtor, StructorType dtorType)

## Function Documentation

## ◆ decomposeTypeForEH()

static QualType decomposeTypeForEH | ( | ASTContext & | Context,
|  | QualType | T,
|  | bool & | IsConst,
|  | bool & | IsVolatile,
|  | bool & | IsUnaligned
| ) |  |
| static

Definition at line 3710 of file MicrosoftCXXABI.cpp.

References clang::Type::getAs(), clang::ASTContext::getExceptionObjectType(), clang::CodeGen::CodeGenModule::getLLVMContext(), clang::ASTContext::getMemberPointerType(), clang::CodeGen::CodeGenModule::getModule(), clang::Type::getPointeeType(), clang::ASTContext::getPointerType(), clang::QualType::getQualifiers(), getTypeInfoVTable(), clang::QualType::getUnqualifiedType(), clang::Qualifiers::hasUnaligned(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::QualType::isConstQualified(), clang::QualType::isNull(), clang::Type::isPointerType(), clang::Type::isReferenceType(), and clang::QualType::isVolatileQualified().

Referenced by emitCXXDestructor().

## ◆ detectAmbiguousBases()

static void detectAmbiguousBases | ( | SmallVectorImpl< MSRTTIClass > & | Classes | ) |
| static

Find ambiguity among base classes.

Definition at line 3506 of file MicrosoftCXXABI.cpp.

References clang::VPtrInfo::FullOffsetInMDC, clang::CodeGen::CodeGenModule::GetAddrOfRTTIDescriptor(), clang::ASTContext::getASTRecordLayout(), clang::CodeGen::CodeGenModule::getMicrosoftVTableContext(), clang::CodeGen::CodeGenModule::getModule(), clang::CXXRecordDecl::getNumVBases(), clang::CharUnits::getQuantity(), clang::ASTContext::getTypeDeclType(), clang::ASTRecordLayout::getVBaseOffsetsMap(), clang::VPtrInfo::getVBaseWithVPtr(), clang::ASTRecordLayout::getVBPtrOffset(), clang::MicrosoftVTableContext::getVBTableIndex(), clang::CodeGen::CodeGenTypeCache::IntTy, clang::VPtrInfo::MangledPath, clang::VPtrInfo::NonVirtualOffset, serializeClassHierarchy(), and clang::CodeGen::Type.

Referenced by emitCXXDestructor().

## ◆ emitCXXConstructor()

static void emitCXXConstructor | ( | CodeGenModule & | CGM,
|  | const CXXConstructorDecl * | ctor,
|  | StructorType | ctorType
| ) |  |
| static

Definition at line 3819 of file MicrosoftCXXABI.cpp.

References clang::CodeGen::CodeGenModule::codegenCXXStructor(), clang::CodeGen::Complete, and clang::CodeGen::CodeGenModule::maybeSetTrivialComdat().

Referenced by emitCXXDestructor().

## ◆ emitCXXDestructor()

static void emitCXXDestructor | ( | CodeGenModule & | CGM,
|  | const CXXDestructorDecl * | dtor,
|  | StructorType | dtorType
| ) |  |
| static

Definition at line 3827 of file MicrosoftCXXABI.cpp.

References clang::CodeGen::CallArgList::add(), clang::CodeGen::CodeGenTypes::arrangeCXXConstructorCall(), clang::CodeGen::CodeGenTypes::arrangeMSCtorClosure(), clang::CodeGen::Base, clang::CodeGen::CodeGenFunction::Builder, clang::Type::castAs(), clang::CodeGen::CodeGenModule::codegenCXXStructor(), clang::CodeGen::Complete, clang::Create(), clang::CodeGen::ApplyDebugLocation::CreateArtificial(), clang::CodeGen::CGBuilderTy::CreateBitCast(), clang::CodeGen::ApplyDebugLocation::CreateEmpty(), clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::Ctor_Complete, clang::Ctor_CopyingClosure, clang::Ctor_DefaultClosure, clang::CodeGen::CodeGenFunction::CurGD, decomposeTypeForEH(), detectAmbiguousBases(), clang::CodeGen::CodeGenFunction::EmitAnyExprToMem(), clang::CodeGen::CodeGenFunction::EmitCall(), clang::CodeGen::CodeGenFunction::EmitCallArgs(), emitCXXConstructor(), clang::CodeGen::CodeGenFunction::EmitNoreturnRuntimeCallOrInvoke(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::CodeGen::CodeGenFunction::RunCleanupsScope::ForceCleanup(), clang::CodeGen::CGCallee::forDirect(), clang::CodeGen::RValue::get(), clang::CodeGen::CodeGenModule::getAddrOfCXXStructor(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::Type::getAsCXXRecordDecl(), clang::ASTContext::getASTRecordLayout(), clang::CodeGen::CodeGenModule::getContext(), clang::ASTContext::getCopyConstructorForExceptionObject(), clang::CXXRecordDecl::getDestructor(), clang::CodeGen::CGFunctionInfo::getEffectiveCallingConvention(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::Decl::getLocation(), clang::CodeGen::CodeGenModule::getMicrosoftVTableContext(), clang::CodeGen::CodeGenModule::getModule(), clang::FunctionDecl::getNumParams(), clang::CXXRecordDecl::getNumVBases(), clang::CXXMethodDecl::getParent(), clang::Type::getPointeeType(), clang::CodeGen::Address::getPointer(), clang::ASTContext::getPointerType(), clang::QualType::getQualifiers(), clang::CharUnits::getQuantity(), clang::CodeGen::CGFunctionInfo::getReturnType(), clang::CXXThrowExpr::getSubExpr(), clang::CXXMethodDecl::getThisType(), getThrowFn(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::TypeDecl::getTypeForDecl(), clang::CodeGen::CodeGenModule::getTypes(), clang::ASTRecordLayout::getVBPtrOffset(), clang::MicrosoftVTableContext::getVBTableIndex(), clang::CodeGen::CodeGenFunction::GetVTablePtr(), hasDefaultCXXMethodCC(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::CodeGen::CodeGenTypeCache::IntTy, clang::Type::isNullPtrType(), clang::Type::isObjectType(), clang::Type::isPointerType(), clang::Type::isReferenceType(), clang::ImplicitParamDecl::Other, clang::FunctionDecl::parameters(), serializeClassHierarchy(), clang::CodeGen::CodeGenFunction::StartFunction(), clang::CodeGen::CodeGenModule::TryEmitBaseDestructorAsAlias(), and clang::CodeGen::Type.

## ◆ emitGlobalDtorWithTLRegDtor()

static void emitGlobalDtorWithTLRegDtor | ( | CodeGenFunction & | CGF,
|  | const VarDecl & | VD,
|  | llvm::Constant * | Dtor,
|  | llvm::Constant * | Addr
| ) |  |
| static

Definition at line 2224 of file MicrosoftCXXABI.cpp.

References clang::CodeGen::CodeGenModule::addUsedGlobal(), clang::CodeGen::CodeGenModule::AppendLinkerOptions(), clang::CodeGen::CodeGenTypes::arrangeNullaryFunction(), clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::createAtExitStub(), clang::CodeGen::CodeGenModule::CreateGlobalInitOrDestructFunction(), clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall(), clang::CodeGen::CodeGenModule::ErrorUnsupported(), clang::CodeGen::CodeGenFunction::GenerateCXXGlobalInitFunc(), clang::CodeGen::CodeGenModule::GetGlobalValue(), clang::CodeGen::CodeGenModule::getMangledName(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getTarget(), clang::VarDecl::getTLSKind(), clang::TargetInfo::getTriple(), clang::CodeGen::CodeGenModule::getTypes(), clang::InternalLinkage, clang::CodeGen::CodeGenTypeCache::IntTy, clang::VarDecl::isNoDestroy(), clang::CodeGen::CodeGenFunction::registerGlobalDtorWithAtExit(), and clang::CodeGen::CodeGenTypeCache::VoidTy.

## ◆ emitRTtypeidCall()

static llvm::CallSite emitRTtypeidCall | ( | CodeGenFunction & | CGF,
|  | llvm::Value * | Argument
| ) |  |
| static

Definition at line 930 of file MicrosoftCXXABI.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CGBuilderTy::CreateBitCast(), clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitRuntimeCallOrInvoke(), clang::CodeGen::CodeGenModule::GetAddrOfRTTIDescriptor(), clang::Type::getAsCXXRecordDecl(), clang::ASTContext::getASTRecordLayout(), clang::GlobalDecl::getDecl(), clang::CodeGen::Address::getPointer(), clang::CharUnits::getQuantity(), clang::ASTContext::getTypeSizeInChars(), clang::QualType::getUnqualifiedType(), clang::ASTRecordLayout::getVBPtrOffset(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::ASTContext::IntTy, clang::Type::isReferenceType(), Offset, and clang::CodeGen::Type.

## ◆ getInitThreadAbortFn()

static llvm::Constant* getInitThreadAbortFn | ( | CodeGenModule & | CGM | ) |
| static

Definition at line 2352 of file MicrosoftCXXABI.cpp.

References clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenModule::getLLVMContext(), and clang::CodeGen::CodeGenTypeCache::IntTy.

## ◆ getInitThreadEpochPtr()

static ConstantAddress getInitThreadEpochPtr | ( | CodeGenModule & | CGM | ) |
| static

Definition at line 2314 of file MicrosoftCXXABI.cpp.

References clang::ExternalLinkage, clang::CodeGen::CodeGenTypeCache::getIntAlign(), clang::CodeGen::CodeGenModule::getModule(), clang::CharUnits::getQuantity(), and clang::CodeGen::CodeGenTypeCache::IntTy.

## ◆ getInitThreadFooterFn()

static llvm::Constant* getInitThreadFooterFn | ( | CodeGenModule & | CGM | ) |
| static

Definition at line 2340 of file MicrosoftCXXABI.cpp.

References clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenModule::getLLVMContext(), and clang::CodeGen::CodeGenTypeCache::IntTy.

## ◆ getInitThreadHeaderFn()

static llvm::Constant* getInitThreadHeaderFn | ( | CodeGenModule & | CGM | ) |
| static

Definition at line 2328 of file MicrosoftCXXABI.cpp.

References clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenModule::getLLVMContext(), and clang::CodeGen::CodeGenTypeCache::IntTy.

## ◆ getTypeInfoVTable()

static llvm::GlobalVariable* getTypeInfoVTable | ( | CodeGenModule & | CGM | ) |
| static

Definition at line 3376 of file MicrosoftCXXABI.cpp.

References clang::AS_public, clang::CXXRecordDecl::bases(), clang::ExternalLinkage, clang::CXXBaseSpecifier::getAccessSpecifier(), clang::Decl::getASTContext(), clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getBaseClassOffset(), clang::Type::getLinkage(), clang::CodeGen::CodeGenModule::getModule(), clang::CharUnits::getQuantity(), clang::initialize(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::InternalLinkage, clang::CXXBaseSpecifier::isVirtual(), clang::ModuleInternalLinkage, clang::ModuleLinkage, clang::NoLinkage, Parent, Specifier, clang::UniqueExternalLinkage, and clang::VisibleNoLinkage.

Referenced by decomposeTypeForEH().

## ◆ hasDefaultCXXMethodCC()

static bool hasDefaultCXXMethodCC | ( | ASTContext & | Context,
|  | const CXXMethodDecl * | MD
| ) |  |
| static

Definition at line 1184 of file MicrosoftCXXABI.cpp.

References clang::CodeGen::CallArgList::add(), clang::CodeGen::CodeGenFunction::Builder, clang::Type::castAs(), clang::CodeGen::CodeGenFunction::CGM, clang::ImplicitParamDecl::Create(), clang::CodeGen::CGBuilderTy::CreateBitCast(), clang::CodeGen::CGBuilderTy::CreateConstByteGEP(), clang::CodeGen::CGBuilderTy::CreateConstInBoundsByteGEP(), clang::CodeGen::CGBuilderTy::CreateConstInBoundsGEP2_32(), clang::CodeGen::CGBuilderTy::CreateElementBitCast(), clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CGBuilderTy::CreateStore(), clang::Ctor_Base, clang::Ctor_Complete, clang::Ctor_DefaultClosure, clang::CodeGen::CodeGenFunction::CurCodeDecl, clang::CodeGen::CodeGenFunction::CurFuncDecl, clang::CodeGen::CodeGenFunction::CurFuncIsThunk, clang::CodeGen::CodeGenFunction::CurGD, clang::CodeGen::Deleting, clang::Dtor_Base, clang::Dtor_Comdat, clang::Dtor_Complete, clang::Dtor_Deleting, clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitCastToVoidPtr(), clang::CodeGen::CodeGenFunction::EmitCXXDestructorCall(), clang::CodeGen::CGCallee::forDirect(), clang::VPtrInfo::FullOffsetInMDC, clang::CodeGen::RValue::get(), clang::IdentifierTable::get(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::Address::getAlignment(), clang::Type::getAs(), clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getBaseClassOffset(), clang::GlobalDecl::getDecl(), clang::ASTContext::getDefaultCallingConvention(), clang::GlobalDecl::getDtorType(), clang::CodeGen::getFromDtorType(), clang::Decl::getLocation(), clang::FunctionDecl::getNumParams(), clang::CXXRecordDecl::getNumVBases(), clang::CXXMethodDecl::getParent(), clang::CodeGen::Address::getPointer(), clang::CharUnits::getQuantity(), clang::CodeGen::Address::getType(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenModule::getVBaseAlignment(), clang::ASTRecordLayout::getVBaseClassOffset(), clang::ASTRecordLayout::getVBaseOffsetsMap(), clang::ASTRecordLayout::getVBPtrOffset(), clang::MicrosoftVTableContext::getVFPtrOffsets(), clang::MicrosoftVTableContext::getVFTableLayout(), clang::GVA_Internal, clang::Decl::hasAttr(), clang::ASTContext::Idents, clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::InternalLinkage, clang::ASTContext::IntTy, clang::CXXConstructorDecl::isDefaultConstructor(), isDeletingDtor(), clang::CharUnits::isPositive(), clang::FunctionProtoType::isVariadic(), clang::CXXMethodDecl::isVirtual(), clang::CharUnits::isZero(), Offset, clang::ImplicitParamDecl::Other, clang::VPtrInfo::PathToIntroducingObject, clang::CodeGen::CodeGenFunction::ReturnValue, clang::CodeGen::Type, clang::MethodVFTableLocation::VBase, clang::MethodVFTableLocation::VFPtrOffset, clang::VTableLayout::vtable_components(), and clang::CharUnits::Zero().

Referenced by emitCXXDestructor(), and clang::index::CodegenNameGenerator::Implementation::getAllManglings().

## ◆ isDeletingDtor()

static bool isDeletingDtor | ( | GlobalDecl | GD | ) |
| static

Definition at line 1044 of file MicrosoftCXXABI.cpp.

References clang::CodeGen::CodeGenFunction::Builder, classifyReturnType(), clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::Dtor_Deleting, clang::CodeGen::CodeGenFunction::EmitBlock(), clang::GlobalDecl::getDecl(), clang::GlobalDecl::getDtorType(), clang::CodeGen::ABIArgInfo::getIndirect(), clang::CodeGen::CGFunctionInfo::getReturnInfo(), clang::CodeGen::CGFunctionInfo::getReturnType(), clang::ASTRecordLayout::getVBaseOffsetsMap(), clang::CodeGen::CGFunctionInfo::isInstanceMethod(), clang::CXXRecordDecl::isPOD(), clang::CodeGen::ABIArgInfo::setSRetAfterThis(), and clang::CodeGen::ABIArgInfo::setSuppressSRet().

Referenced by hasDefaultCXXMethodCC().

## ◆ mangleVFTableName()

static void mangleVFTableName | ( | MicrosoftMangleContext & | MangleContext,
|  | const CXXRecordDecl * | RD,
|  | const VPtrInfo & | VFPtr,
|  | SmallString< 256 > & | Name
| ) |  |
| static

Definition at line 1673 of file MicrosoftCXXABI.cpp.

References clang::BaseSubobject::getBaseOffset(), clang::MicrosoftVTableContext::getVFPtrOffsets(), clang::MicrosoftMangleContext::mangleCXXVFTable(), and clang::VPtrInfo::MangledPath.

## ◆ serializeClassHierarchy()

static void serializeClassHierarchy | ( | SmallVectorImpl< MSRTTIClass > & | Classes,
|  | const CXXRecordDecl * | RD
| ) |  |
| static

Recursively serializes a class hierarchy in pre-order depth first order.

Definition at line 3497 of file MicrosoftCXXABI.cpp.

References clang::CXXRecordDecl::bases(), and clang::CodeGen::Address::getType().

Referenced by detectAmbiguousBases(), and emitCXXDestructor().