clang API Documentation
#include "CGCXXABI.h"
#include "CGRecordLayout.h"
#include "CGVTables.h"
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
#include "clang/AST/Mangle.h"
#include "clang/AST/Type.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Value.h"
#include "clang/AST/BuiltinTypes.def"
#include "clang/AST/TypeNodes.def"
Go to the source code of this file.
Defines | |
#define | BUILTIN_TYPE(Id, SingletonId) |
#define | PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id: |
#define | TYPE(Class, Base) |
#define | ABSTRACT_TYPE(Class, Base) |
#define | NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class: |
#define | NON_CANONICAL_TYPE(Class, Base) case Type::Class: |
#define | DEPENDENT_TYPE(Class, Base) case Type::Class: |
#define | TYPE(Class, Base) |
#define | ABSTRACT_TYPE(Class, Base) |
#define | NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class: |
#define | NON_CANONICAL_TYPE(Class, Base) case Type::Class: |
#define | DEPENDENT_TYPE(Class, Base) case Type::Class: |
Enumerations | |
enum | StructorCodegen |
Functions | |
static llvm::Constant * | getItaniumDynamicCastFn (CodeGenFunction &CGF) |
static llvm::Constant * | getBadCastFn (CodeGenFunction &CGF) |
static CharUnits | computeOffsetHint (ASTContext &Context, const CXXRecordDecl *Src, const CXXRecordDecl *Dst) |
Compute the src2dst_offset hint as described in the Itanium C++ ABI [2.9.7]. | |
static llvm::Constant * | getBadTypeidFn (CodeGenFunction &CGF) |
static llvm::Value * | performTypeAdjustment (CodeGenFunction &CGF, llvm::Value *Ptr, int64_t NonVirtualAdjustment, int64_t VirtualAdjustment, bool IsReturnAdjustment) |
static llvm::Constant * | getGuardAcquireFn (CodeGenModule &CGM, llvm::PointerType *GuardPtrTy) |
static llvm::Constant * | getGuardReleaseFn (CodeGenModule &CGM, llvm::PointerType *GuardPtrTy) |
static llvm::Constant * | getGuardAbortFn (CodeGenModule &CGM, llvm::PointerType *GuardPtrTy) |
static void | emitGlobalDtorWithCXAAtExit (CodeGenFunction &CGF, llvm::Constant *dtor, llvm::Constant *addr, bool TLS) |
Register a global destructor using __cxa_atexit. | |
static bool | isThreadWrapperReplaceable (const VarDecl *VD, CodeGen::CodeGenModule &CGM) |
static llvm::GlobalValue::LinkageTypes | getThreadLocalWrapperLinkage (const VarDecl *VD, CodeGen::CodeGenModule &CGM) |
static bool | TypeInfoIsInStandardLibrary (const BuiltinType *Ty) |
static bool | TypeInfoIsInStandardLibrary (const PointerType *PointerTy) |
static bool | IsStandardLibraryRTTIDescriptor (QualType Ty) |
static bool | ShouldUseExternalRTTIDescriptor (CodeGenModule &CGM, QualType Ty) |
static bool | IsIncompleteClassType (const RecordType *RecordTy) |
IsIncompleteClassType - Returns whether the given record type is incomplete. | |
static bool | ContainsIncompleteClassType (QualType Ty) |
static bool | CanUseSingleInheritance (const CXXRecordDecl *RD) |
static llvm::GlobalVariable::LinkageTypes | getTypeInfoLinkage (CodeGenModule &CGM, QualType Ty) |
Return the linkage that the type info and type info name constants should have for the given type. | |
static unsigned | ComputeQualifierFlags (Qualifiers Quals) |
static unsigned | ComputeVMIClassTypeInfoFlags (const CXXBaseSpecifier *Base, SeenBases &Bases) |
static unsigned | ComputeVMIClassTypeInfoFlags (const CXXRecordDecl *RD) |
static StructorCodegen | getCodegenToUse (CodeGenModule &CGM, const CXXMethodDecl *MD) |
static void | emitConstructorDestructorAlias (CodeGenModule &CGM, GlobalDecl AliasDecl, GlobalDecl TargetDecl) |
#define ABSTRACT_TYPE | ( | Class, | |
Base | |||
) |
#define ABSTRACT_TYPE | ( | Class, | |
Base | |||
) |
#define BUILTIN_TYPE | ( | Id, | |
SingletonId | |||
) |
#define DEPENDENT_TYPE | ( | Class, | |
Base | |||
) | case Type::Class: |
#define DEPENDENT_TYPE | ( | Class, | |
Base | |||
) | case Type::Class: |
#define NON_CANONICAL_TYPE | ( | Class, | |
Base | |||
) | case Type::Class: |
#define NON_CANONICAL_TYPE | ( | Class, | |
Base | |||
) | case Type::Class: |
#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE | ( | Class, | |
Base | |||
) | case Type::Class: |
#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE | ( | Class, | |
Base | |||
) | case Type::Class: |
#define PLACEHOLDER_TYPE | ( | Id, | |
SingletonId | |||
) | case BuiltinType::Id: |
enum StructorCodegen |
Definition at line 3068 of file CodeGen/ItaniumCXXABI.cpp.
static bool CanUseSingleInheritance | ( | const CXXRecordDecl * | RD | ) | [static] |
Definition at line 2371 of file CodeGen/ItaniumCXXABI.cpp.
References clang::AS_public, clang::CXXRecordDecl::bases_begin(), clang::CXXBaseSpecifier::getAccessSpecifier(), clang::Type::getAs(), clang::CXXRecordDecl::getNumBases(), clang::CXXBaseSpecifier::getType(), clang::CXXRecordDecl::isDynamicClass(), clang::CXXRecordDecl::isEmpty(), and clang::CXXBaseSpecifier::isVirtual().
static CharUnits computeOffsetHint | ( | ASTContext & | Context, |
const CXXRecordDecl * | Src, | ||
const CXXRecordDecl * | Dst | ||
) | [static] |
Compute the src2dst_offset hint as described in the Itanium C++ ABI [2.9.7].
Definition at line 921 of file CodeGen/ItaniumCXXABI.cpp.
References clang::AS_public, clang::CXXBasePaths::begin(), clang::CXXBasePaths::end(), clang::CharUnits::fromQuantity(), clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getBaseClassOffset(), and clang::CXXRecordDecl::isDerivedFrom().
static unsigned ComputeQualifierFlags | ( | Qualifiers | Quals | ) | [static] |
ComputeQualifierFlags - Compute the pointer type info flags from the given qualifier.
Definition at line 2748 of file CodeGen/ItaniumCXXABI.cpp.
References clang::Qualifiers::hasConst(), clang::Qualifiers::hasRestrict(), and clang::Qualifiers::hasVolatile().
static unsigned ComputeVMIClassTypeInfoFlags | ( | const CXXBaseSpecifier * | Base, |
SeenBases & | Bases | ||
) | [static] |
ComputeVMIClassTypeInfoFlags - Compute the value of the flags member in abi::__vmi_class_type_info.
Definition at line 2809 of file CodeGen/ItaniumCXXABI.cpp.
References clang::CXXRecordDecl::bases(), clang::Type::getAs(), clang::CXXBaseSpecifier::getType(), and clang::CXXBaseSpecifier::isVirtual().
Referenced by ComputeVMIClassTypeInfoFlags().
static unsigned ComputeVMIClassTypeInfoFlags | ( | const CXXRecordDecl * | RD | ) | [static] |
Definition at line 2846 of file CodeGen/ItaniumCXXABI.cpp.
References clang::CXXRecordDecl::bases(), and ComputeVMIClassTypeInfoFlags().
static bool ContainsIncompleteClassType | ( | QualType | Ty | ) | [static] |
ContainsIncompleteClassType - Returns whether the given type contains an incomplete class type. This is true if
The given type is an incomplete class type. The given type is a pointer type whose pointee type contains an incomplete class type. The given type is a member pointer type whose class is an incomplete class type. The given type is a member pointer type whoise pointee type contains an incomplete class type. is an indirect or direct pointer to an incomplete class type.
Definition at line 2346 of file CodeGen/ItaniumCXXABI.cpp.
References IsIncompleteClassType().
Referenced by getTypeInfoLinkage().
static void emitConstructorDestructorAlias | ( | CodeGenModule & | CGM, |
GlobalDecl | AliasDecl, | ||
GlobalDecl | TargetDecl | ||
) | [static] |
Definition at line 3106 of file CodeGen/ItaniumCXXABI.cpp.
References clang::serialized_diags::create(), clang::CodeGen::CodeGenModule::GetAddrOfGlobal(), clang::GlobalDecl::getDecl(), clang::CodeGen::CodeGenModule::getFunctionLinkage(), clang::CodeGen::CodeGenModule::GetGlobalValue(), clang::CodeGen::CodeGenModule::getMangledName(), clang::CodeGen::CodeGenModule::getModule(), and clang::CodeGen::CodeGenModule::setAliasAttributes().
static void emitGlobalDtorWithCXAAtExit | ( | CodeGenFunction & | CGF, |
llvm::Constant * | dtor, | ||
llvm::Constant * | addr, | ||
bool | TLS | ||
) | [static] |
Register a global destructor using __cxa_atexit.
Definition at line 1807 of file CodeGen/ItaniumCXXABI.cpp.
References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenModule::CreateRuntimeVariable(), clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall(), clang::CodeGen::CodeGenFunction::getTarget(), clang::TargetInfo::getTriple(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::CodeGen::CodeGenTypeCache::IntTy, and clang::CodeGen::CodeGenTypeCache::VoidTy.
static llvm::Constant* getBadCastFn | ( | CodeGenFunction & | CGF | ) | [static] |
Definition at line 913 of file CodeGen/ItaniumCXXABI.cpp.
References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), and clang::CodeGen::CodeGenTypeCache::VoidTy.
static llvm::Constant* getBadTypeidFn | ( | CodeGenFunction & | CGF | ) | [static] |
Definition at line 971 of file CodeGen/ItaniumCXXABI.cpp.
References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), and clang::CodeGen::CodeGenTypeCache::VoidTy.
static StructorCodegen getCodegenToUse | ( | CodeGenModule & | CGM, |
const CXXMethodDecl * | MD | ||
) | [static] |
Definition at line 3070 of file CodeGen/ItaniumCXXABI.cpp.
References clang::Ctor_Complete, clang::Dtor_Complete, clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getFunctionLinkage(), clang::CXXRecordDecl::getNumVBases(), clang::CXXMethodDecl::getParent(), clang::CodeGen::CodeGenModule::getTarget(), and clang::TargetInfo::getTriple().
static llvm::Constant* getGuardAbortFn | ( | CodeGenModule & | CGM, |
llvm::PointerType * | GuardPtrTy | ||
) | [static] |
Definition at line 1624 of file CodeGen/ItaniumCXXABI.cpp.
References clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenModule::getLLVMContext(), and clang::CodeGen::CodeGenTypeCache::VoidTy.
static llvm::Constant* getGuardAcquireFn | ( | CodeGenModule & | CGM, |
llvm::PointerType * | GuardPtrTy | ||
) | [static] |
Definition at line 1601 of file CodeGen/ItaniumCXXABI.cpp.
References clang::CodeGen::CodeGenTypes::ConvertType(), clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getLLVMContext(), clang::CodeGen::CodeGenModule::getTypes(), and clang::ASTContext::IntTy.
static llvm::Constant* getGuardReleaseFn | ( | CodeGenModule & | CGM, |
llvm::PointerType * | GuardPtrTy | ||
) | [static] |
Definition at line 1613 of file CodeGen/ItaniumCXXABI.cpp.
References clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenModule::getLLVMContext(), and clang::CodeGen::CodeGenTypeCache::VoidTy.
static llvm::Constant* getItaniumDynamicCastFn | ( | CodeGenFunction & | CGF | ) | [static] |
Definition at line 890 of file CodeGen/ItaniumCXXABI.cpp.
References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::ASTContext::getPointerDiffType(), and clang::CodeGen::CodeGenTypeCache::Int8PtrTy.
static llvm::GlobalValue::LinkageTypes getThreadLocalWrapperLinkage | ( | const VarDecl * | VD, |
CodeGen::CodeGenModule & | CGM | ||
) | [static] |
Get the appropriate linkage for the wrapper function. This is essentially the weak form of the variable's linkage; every translation unit which needs the wrapper emits a copy, and we want the linker to merge them.
Definition at line 1880 of file CodeGen/ItaniumCXXABI.cpp.
References clang::CodeGen::CodeGenModule::getLLVMLinkageVarDefinition(), and isThreadWrapperReplaceable().
static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage | ( | CodeGenModule & | CGM, |
QualType | Ty | ||
) | [static] |
Return the linkage that the type info and type info name constants should have for the given type.
Definition at line 2520 of file CodeGen/ItaniumCXXABI.cpp.
References ContainsIncompleteClassType(), clang::ExternalLinkage, clang::CodeGen::CodeGenModule::getLangOpts(), clang::Type::getLinkage(), clang::CodeGen::CodeGenModule::getVTableLinkage(), clang::Decl::hasAttr(), clang::InternalLinkage, clang::CXXRecordDecl::isDynamicClass(), clang::NoLinkage, Record, clang::UniqueExternalLinkage, and clang::VisibleNoLinkage.
static bool IsIncompleteClassType | ( | const RecordType * | RecordTy | ) | [static] |
IsIncompleteClassType - Returns whether the given record type is incomplete.
Definition at line 2331 of file CodeGen/ItaniumCXXABI.cpp.
References clang::RecordType::getDecl(), and clang::TagDecl::isCompleteDefinition().
Referenced by ContainsIncompleteClassType().
static bool IsStandardLibraryRTTIDescriptor | ( | QualType | Ty | ) | [static] |
IsStandardLibraryRTTIDescriptor - Returns whether the type information for the given type exists in the standard library.
Definition at line 2285 of file CodeGen/ItaniumCXXABI.cpp.
References TypeInfoIsInStandardLibrary().
static bool isThreadWrapperReplaceable | ( | const VarDecl * | VD, |
CodeGen::CodeGenModule & | CGM | ||
) | [static] |
Definition at line 1867 of file CodeGen/ItaniumCXXABI.cpp.
References clang::CodeGen::CodeGenModule::getTarget(), clang::VarDecl::getTLSKind(), clang::TargetInfo::getTriple(), clang::VarDecl::isStaticLocal(), and clang::VarDecl::TLS_Dynamic.
Referenced by getThreadLocalWrapperLinkage().
static llvm::Value* performTypeAdjustment | ( | CodeGenFunction & | CGF, |
llvm::Value * | Ptr, | ||
int64_t | NonVirtualAdjustment, | ||
int64_t | VirtualAdjustment, | ||
bool | IsReturnAdjustment | ||
) | [static] |
static bool ShouldUseExternalRTTIDescriptor | ( | CodeGenModule & | CGM, |
QualType | Ty | ||
) | [static] |
ShouldUseExternalRTTIDescriptor - Returns whether the type information for the given type exists somewhere else, and that we should not emit the type information in this translation unit. Assumes that it is not a standard-library type.
Definition at line 2302 of file CodeGen/ItaniumCXXABI.cpp.
References clang::CodeGen::CodeGenModule::getContext(), clang::ASTContext::getLangOpts(), clang::CodeGen::CodeGenModule::getVTables(), clang::Decl::hasAttr(), clang::CXXRecordDecl::hasDefinition(), clang::CXXRecordDecl::isDynamicClass(), and clang::CodeGen::CodeGenVTables::isVTableExternal().
static bool TypeInfoIsInStandardLibrary | ( | const BuiltinType * | Ty | ) | [static] |
TypeInfoIsInStandardLibrary - Given a builtin type, returns whether the type info for that type is defined in the standard library.
Definition at line 2205 of file CodeGen/ItaniumCXXABI.cpp.
References clang::BuiltinType::getKind().
Referenced by IsStandardLibraryRTTIDescriptor(), and TypeInfoIsInStandardLibrary().
static bool TypeInfoIsInStandardLibrary | ( | const PointerType * | PointerTy | ) | [static] |
Definition at line 2267 of file CodeGen/ItaniumCXXABI.cpp.
References clang::Qualifiers::empty(), clang::PointerType::getPointeeType(), clang::QualType::getQualifiers(), clang::Qualifiers::removeConst(), and TypeInfoIsInStandardLibrary().