clang API Documentation
#include "clang/AST/RecordLayout.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Sema/SemaDiagnostic.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/Support/CrashRecoveryContext.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/MathExtras.h"
Go to the source code of this file.
Functions | |
static uint64_t | roundUpSizeToCharAlignment (uint64_t Size, const ASTContext &Context) |
static unsigned | getPaddingDiagFromTagKind (TagTypeKind Tag) |
Get diagnostic select index for tag kind for field padding diagnostic message. WARNING: Indexes apply to particular diagnostics only! | |
static const CXXMethodDecl * | computeKeyFunction (ASTContext &Context, const CXXRecordDecl *RD) |
static bool | mustSkipTailPadding (TargetCXXABI ABI, const CXXRecordDecl *RD) |
static bool | isMsLayout (const RecordDecl *D) |
static bool | RequiresVtordisp (const llvm::SmallPtrSetImpl< const CXXRecordDecl * > &BasesWithOverriddenMethods, const CXXRecordDecl *RD) |
static uint64_t | getFieldOffset (const ASTContext &C, const FieldDecl *FD) |
static void | PrintOffset (raw_ostream &OS, CharUnits Offset, unsigned IndentLevel) |
static void | PrintIndentNoOffset (raw_ostream &OS, unsigned IndentLevel) |
static void | DumpCXXRecordLayout (raw_ostream &OS, const CXXRecordDecl *RD, const ASTContext &C, CharUnits Offset, unsigned IndentLevel, const char *Description, bool IncludeVirtualBases) |
static const CXXMethodDecl* computeKeyFunction | ( | ASTContext & | Context, |
const CXXRecordDecl * | RD | ||
) | [static] |
Definition at line 1946 of file RecordLayoutBuilder.cpp.
References clang::TargetCXXABI::canKeyFunctionBeInline(), clang::TargetInfo::getCXXABI(), clang::ASTContext::getTargetInfo(), clang::CXXRecordDecl::getTemplateSpecializationKind(), clang::NamedDecl::isExternallyVisible(), clang::FunctionDecl::isInlineSpecified(), clang::CXXRecordDecl::isPolymorphic(), clang::CXXRecordDecl::methods(), clang::TSK_ExplicitInstantiationDeclaration, clang::TSK_ExplicitInstantiationDefinition, and clang::TSK_ImplicitInstantiation.
Referenced by clang::ASTContext::getCurrentKeyFunction().
static void DumpCXXRecordLayout | ( | raw_ostream & | OS, |
const CXXRecordDecl * | RD, | ||
const ASTContext & | C, | ||
CharUnits | Offset, | ||
unsigned | IndentLevel, | ||
const char * | Description, | ||
bool | IncludeVirtualBases | ||
) | [static] |
Definition at line 3003 of file RecordLayoutBuilder.cpp.
References clang::CXXRecordDecl::bases(), clang::CharUnits::fromQuantity(), clang::ASTRecordLayout::getAlignment(), clang::Type::getAsCXXRecordDecl(), clang::QualType::getAsString(), clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getBaseClassOffset(), clang::ASTRecordLayout::getDataSize(), clang::ASTRecordLayout::getFieldOffset(), clang::NamedDecl::getName(), clang::ASTRecordLayout::getNonVirtualAlignment(), clang::ASTRecordLayout::getNonVirtualSize(), clang::ASTRecordLayout::getPrimaryBase(), clang::CharUnits::getQuantity(), clang::ASTRecordLayout::getSize(), clang::ValueDecl::getType(), clang::ASTContext::getTypeDeclType(), clang::ASTRecordLayout::getVBaseClassOffset(), clang::ASTRecordLayout::getVBaseOffsetsMap(), clang::ASTRecordLayout::getVBPtrOffset(), clang::ASTRecordLayout::hasOwnVBPtr(), clang::ASTRecordLayout::hasOwnVFPtr(), clang::CXXRecordDecl::isDynamicClass(), clang::CXXRecordDecl::isEmpty(), isMsLayout(), PrintIndentNoOffset(), PrintOffset(), clang::ASTContext::toCharUnitsFromBits(), and clang::CXXRecordDecl::vbases().
Referenced by clang::ASTContext::DumpRecordLayout().
static uint64_t getFieldOffset | ( | const ASTContext & | C, |
const FieldDecl * | FD | ||
) | [static] |
Definition at line 2924 of file RecordLayoutBuilder.cpp.
References clang::ASTContext::getASTRecordLayout(), clang::FieldDecl::getFieldIndex(), clang::ASTRecordLayout::getFieldOffset(), and clang::FieldDecl::getParent().
static unsigned getPaddingDiagFromTagKind | ( | TagTypeKind | Tag | ) | [static] |
Get diagnostic select index for tag kind for field padding diagnostic message. WARNING: Indexes apply to particular diagnostics only!
Definition at line 1889 of file RecordLayoutBuilder.cpp.
References clang::TTK_Class, clang::TTK_Interface, and clang::TTK_Struct.
static bool isMsLayout | ( | const RecordDecl * | D | ) | [static] |
Definition at line 2052 of file RecordLayoutBuilder.cpp.
References clang::Decl::getASTContext(), clang::TargetInfo::getCXXABI(), clang::ASTContext::getTargetInfo(), and clang::TargetCXXABI::isMicrosoft().
Referenced by DumpCXXRecordLayout(), clang::ASTContext::DumpRecordLayout(), and clang::ASTContext::getASTRecordLayout().
static bool mustSkipTailPadding | ( | TargetCXXABI | ABI, |
const CXXRecordDecl * | RD | ||
) | [static] |
Does the target C++ ABI require us to skip over the tail-padding of the given class (considering it as a base class) when allocating objects?
Definition at line 2013 of file RecordLayoutBuilder.cpp.
References clang::TargetCXXABI::AlwaysUseTailPadding, clang::TargetCXXABI::getTailPaddingUseRules(), clang::CXXRecordDecl::isPOD(), clang::CXXRecordDecl::isStandardLayout(), clang::CXXRecordDecl::isTrivial(), clang::TargetCXXABI::UseTailPaddingUnlessPOD03, and clang::TargetCXXABI::UseTailPaddingUnlessPOD11.
Referenced by clang::ASTContext::getASTRecordLayout().
static void PrintIndentNoOffset | ( | raw_ostream & | OS, |
unsigned | IndentLevel | ||
) | [static] |
Definition at line 2998 of file RecordLayoutBuilder.cpp.
Referenced by DumpCXXRecordLayout().
static void PrintOffset | ( | raw_ostream & | OS, |
CharUnits | Offset, | ||
unsigned | IndentLevel | ||
) | [static] |
Definition at line 2992 of file RecordLayoutBuilder.cpp.
References clang::CharUnits::getQuantity().
Referenced by DumpCXXRecordLayout().
static bool RequiresVtordisp | ( | const llvm::SmallPtrSetImpl< const CXXRecordDecl * > & | BasesWithOverriddenMethods, |
const CXXRecordDecl * | RD | ||
) | [static] |
Definition at line 2685 of file RecordLayoutBuilder.cpp.
References clang::CXXRecordDecl::bases().
static uint64_t roundUpSizeToCharAlignment | ( | uint64_t | Size, |
const ASTContext & | Context | ||
) | [static] |
Definition at line 1345 of file RecordLayoutBuilder.cpp.
References clang::TargetInfo::getCharAlign(), and clang::ASTContext::getTargetInfo().