clang API Documentation
The basic abstraction for the target C++ ABI. More...
#include <TargetCXXABI.h>
Public Types | |
enum | Kind { GenericItanium, GenericARM, iOS, iOS64, GenericAArch64, Microsoft } |
The basic C++ ABI kind. More... | |
enum | TailPaddingUseRules { AlwaysUseTailPadding, UseTailPaddingUnlessPOD03, UseTailPaddingUnlessPOD11 } |
Public Member Functions | |
TargetCXXABI () | |
A bogus initialization of the platform ABI. | |
TargetCXXABI (Kind kind) | |
void | set (Kind kind) |
Kind | getKind () const |
bool | isItaniumFamily () const |
Does this ABI generally fall into the Itanium family of ABIs? | |
bool | isMicrosoft () const |
Is this ABI an MSVC-compatible ABI? | |
bool | isMemberFunctionCCDefault () const |
Is the default C++ member function calling convention the same as the default calling convention? | |
bool | areArgsDestroyedLeftToRightInCallee () const |
bool | hasConstructorVariants () const |
Does this ABI have different entrypoints for complete-object and base-subobject constructors? | |
bool | hasPrimaryVBases () const |
Does this ABI allow virtual bases to be primary base classes? | |
bool | hasKeyFunctions () const |
Does this ABI use key functions? If so, class data such as the vtable is emitted with strong linkage by the TU containing the key function. | |
bool | canKeyFunctionBeInline () const |
Can an out-of-line inline function serve as a key function? | |
TailPaddingUseRules | getTailPaddingUseRules () const |
bool | tryParse (llvm::StringRef name) |
Try to parse an ABI name, returning false on error. | |
Friends | |
bool | operator== (const TargetCXXABI &left, const TargetCXXABI &right) |
bool | operator!= (const TargetCXXABI &left, const TargetCXXABI &right) |
The basic abstraction for the target C++ ABI.
Definition at line 25 of file TargetCXXABI.h.
The basic C++ ABI kind.
GenericItanium |
The generic Itanium ABI is the standard ABI of most open-source and Unix-like platforms. It is the primary ABI targeted by many compilers, including Clang and GCC. It is documented here: http://www.codesourcery.com/public/cxx-abi/ |
GenericARM |
The generic ARM ABI is a modified version of the Itanium ABI proposed by ARM for use on ARM-based platforms. These changes include:
It is documented here: http://infocenter.arm.com /help/topic/com.arm.doc.ihi0041c/IHI0041C_cppabi.pdf |
iOS |
The iOS ABI is a partial implementation of the ARM ABI. Several of the features of the ARM ABI were not fully implemented in the compilers that iOS was launched with. Essentially, the iOS ABI includes the ARM changes to:
|
iOS64 |
The iOS 64-bit ABI is follows ARM's published 64-bit ABI more closely, but we don't guarantee to follow it perfectly. It is documented here: http://infocenter.arm.com /help/topic/com.arm.doc.ihi0059a/IHI0059A_cppabi64.pdf |
GenericAArch64 |
The generic AArch64 ABI is also a modified version of the Itanium ABI, but it has fewer divergences than the 32-bit ARM ABI. The relevant changes from the generic ABI in this case are:
|
Microsoft |
The Microsoft ABI is the ABI used by Microsoft Visual Studio (and compatible compilers). FIXME: should this be split into Win32 and Win64 variants? Only scattered and incomplete official documentation exists. |
Definition at line 28 of file TargetCXXABI.h.
When is record layout allowed to allocate objects in the tail padding of a base class?
This decision cannot be changed without breaking platform ABI compatibility, and yet it is tied to language guarantees which the committee has so far seen fit to strengthen no less than three separate times:
Definition at line 236 of file TargetCXXABI.h.
clang::TargetCXXABI::TargetCXXABI | ( | ) | [inline] |
A bogus initialization of the platform ABI.
Definition at line 99 of file TargetCXXABI.h.
clang::TargetCXXABI::TargetCXXABI | ( | Kind | kind | ) | [inline] |
Definition at line 101 of file TargetCXXABI.h.
bool clang::TargetCXXABI::areArgsDestroyedLeftToRightInCallee | ( | ) | const [inline] |
Are arguments to a call destroyed left to right in the callee? This is a fundamental language change, since it implies that objects passed by value do *not* live to the end of the full expression. Temporaries passed to a function taking a const reference live to the end of the full expression as usual. Both the caller and the callee must have access to the destructor, while only the caller needs the destructor if this is false.
Definition at line 155 of file TargetCXXABI.h.
References isMicrosoft().
Referenced by clang::Sema::CheckParmsForFunctionDef(), deactivateArgCleanupsBeforeCall(), clang::CodeGen::CodeGenFunction::EmitCallArg(), clang::CodeGen::CodeGenFunction::EmitCallArgs(), and clang::CodeGen::CodeGenFunction::EmitParmDecl().
bool clang::TargetCXXABI::canKeyFunctionBeInline | ( | ) | const [inline] |
Can an out-of-line inline function serve as a key function?
This flag is only useful in ABIs where type data (for example, v-tables and type_info objects) are emitted only after processing the definition of a special "key" virtual function. (This is safe because the ODR requires that every virtual function be defined somewhere in a program.) This usually permits such data to be emitted in only a single object file, as opposed to redundantly in every object file that requires it.
One simple and common definition of "key function" is the first virtual function in the class definition which is not defined there. This rule works very well when that function has a non-inline definition in some non-header file. Unfortunately, when that function is defined inline, this rule requires the type data to be emitted weakly, as if there were no key function.
The ARM ABI observes that the ODR provides an additional guarantee: a virtual function is always ODR-used, so if it is defined inline, that definition must appear in every translation unit that defines the class. Therefore, there is no reason to allow such functions to serve as key functions.
Because this changes the rules for emitting type data, it can cause type data to be emitted with both weak and strong linkage, which is not allowed on all platforms. Therefore, exploiting this observation requires an ABI break and cannot be done on a generic Itanium platform.
Definition at line 205 of file TargetCXXABI.h.
References GenericAArch64, GenericARM, GenericItanium, getKind(), iOS, iOS64, and Microsoft.
Referenced by clang::Sema::CheckFunctionDeclaration(), and computeKeyFunction().
Kind clang::TargetCXXABI::getKind | ( | ) | const [inline] |
Definition at line 107 of file TargetCXXABI.h.
Referenced by canKeyFunctionBeInline(), createCXXABI(), clang::CodeGen::CreateItaniumCXXABI(), clang::ASTContext::createMangleContext(), getTailPaddingUseRules(), isItaniumFamily(), and isMicrosoft().
TailPaddingUseRules clang::TargetCXXABI::getTailPaddingUseRules | ( | ) | const [inline] |
Definition at line 251 of file TargetCXXABI.h.
References AlwaysUseTailPadding, GenericAArch64, GenericARM, GenericItanium, getKind(), iOS, iOS64, Microsoft, UseTailPaddingUnlessPOD03, and UseTailPaddingUnlessPOD11.
Referenced by mustSkipTailPadding().
bool clang::TargetCXXABI::hasConstructorVariants | ( | ) | const [inline] |
Does this ABI have different entrypoints for complete-object and base-subobject constructors?
Definition at line 161 of file TargetCXXABI.h.
References isItaniumFamily().
Referenced by clang::CodeGen::CodeGenFunction::EmitConstructorBody(), clang::CodeGen::CGCXXABI::EmitCtorCompleteObjectHandler(), and clang::CodeGen::CodeGenFunction::EmitCtorPrologue().
bool clang::TargetCXXABI::hasKeyFunctions | ( | ) | const [inline] |
Does this ABI use key functions? If so, class data such as the vtable is emitted with strong linkage by the TU containing the key function.
Definition at line 173 of file TargetCXXABI.h.
References isItaniumFamily().
bool clang::TargetCXXABI::hasPrimaryVBases | ( | ) | const [inline] |
Does this ABI allow virtual bases to be primary base classes?
Definition at line 166 of file TargetCXXABI.h.
References isItaniumFamily().
bool clang::TargetCXXABI::isItaniumFamily | ( | ) | const [inline] |
Does this ABI generally fall into the Itanium family of ABIs?
Definition at line 110 of file TargetCXXABI.h.
References GenericAArch64, GenericARM, GenericItanium, getKind(), iOS, iOS64, and Microsoft.
Referenced by hasConstructorVariants(), hasKeyFunctions(), hasPrimaryVBases(), and useClangCallTerminate().
bool clang::TargetCXXABI::isMemberFunctionCCDefault | ( | ) | const [inline] |
Is the default C++ member function calling convention the same as the default calling convention?
Definition at line 143 of file TargetCXXABI.h.
References isMicrosoft().
bool clang::TargetCXXABI::isMicrosoft | ( | ) | const [inline] |
Is this ABI an MSVC-compatible ABI?
Definition at line 126 of file TargetCXXABI.h.
References GenericAArch64, GenericARM, GenericItanium, getKind(), iOS, iOS64, and Microsoft.
Referenced by areArgsDestroyedLeftToRightInCallee(), BuildAppleKextVirtualCall(), clang::Sema::BuildArrayType(), clang::Sema::BuildCallToMemberFunction(), clang::Sema::CheckAddressOfOperand(), clang::Sema::CheckBaseSpecifier(), checkDLLAttribute(), checkDLLAttributeRedeclaration(), CheckTemplateArgumentPointerToMember(), getConstantArrayInfoInChars(), getUniqueTagTypeName(), clang::ASTContext::getVTableContext(), handleDLLAttr(), isMemberFunctionCCDefault(), isMsLayout(), clang::Sema::MarkVTableUsed(), clang::Sema::PerformImplicitConversion(), TryReinterpretCast(), TryStaticImplicitCast(), and clang::Sema::VerifyBitField().
void clang::TargetCXXABI::set | ( | Kind | kind | ) | [inline] |
Definition at line 103 of file TargetCXXABI.h.
Referenced by clang::TargetInfo::TargetInfo().
bool TargetCXXABI::tryParse | ( | llvm::StringRef | name | ) |
Try to parse an ABI name, returning false on error.
Definition at line 626 of file Basic/TargetInfo.cpp.
References GenericARM, GenericItanium, iOS, and Microsoft.
Referenced by clang::TargetInfo::setCXXABI().
bool operator!= | ( | const TargetCXXABI & | left, |
const TargetCXXABI & | right | ||
) | [friend] |
Definition at line 282 of file TargetCXXABI.h.
bool operator== | ( | const TargetCXXABI & | left, |
const TargetCXXABI & | right | ||
) | [friend] |
Definition at line 278 of file TargetCXXABI.h.