clang
10.0.0git
|
#include "clang/AST/RecordLayout.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.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 "llvm/ADT/SmallSet.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. More... | |
static const CXXMethodDecl * | computeKeyFunction (ASTContext &Context, const CXXRecordDecl *RD) |
static bool | mustSkipTailPadding (TargetCXXABI ABI, const CXXRecordDecl *RD) |
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? More... | |
static bool | isMsLayout (const ASTContext &Context) |
static bool | recordUsesEBO (const RecordDecl *RD) |
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 | PrintBitFieldOffset (raw_ostream &OS, CharUnits Offset, unsigned Begin, unsigned Width, unsigned IndentLevel) |
static void | PrintIndentNoOffset (raw_ostream &OS, unsigned IndentLevel) |
static void | DumpRecordLayout (raw_ostream &OS, const RecordDecl *RD, const ASTContext &C, CharUnits Offset, unsigned IndentLevel, const char *Description, bool PrintSizeInfo, bool IncludeVirtualBases) |
|
static |
Definition at line 2075 of file RecordLayoutBuilder.cpp.
References clang::TargetCXXABI::canKeyFunctionBeInline(), Diag(), clang::TargetInfo::getCXXABI(), clang::ASTContext::getDiagnostics(), clang::ASTContext::getLangOpts(), clang::ASTContext::getTargetInfo(), clang::CXXRecordDecl::getTemplateSpecializationKind(), clang::Decl::hasAttr(), clang::NamedDecl::isExternallyVisible(), clang::FunctionDecl::isInlineSpecified(), clang::CXXRecordDecl::isPolymorphic(), clang::CXXRecordDecl::methods(), clang::DiagnosticsEngine::Report(), clang::TSK_ExplicitInstantiationDeclaration, clang::TSK_ExplicitInstantiationDefinition, and clang::TSK_ImplicitInstantiation.
Referenced by clang::ASTContext::getCurrentKeyFunction().
|
static |
Definition at line 3290 of file RecordLayoutBuilder.cpp.
References Begin, clang::C, clang::RecordDecl::field_begin(), clang::RecordDecl::field_end(), clang::CharUnits::fromQuantity(), clang::ASTRecordLayout::getAlignment(), clang::Type::getAs(), clang::QualType::getAsString(), clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getBaseClassOffset(), clang::FieldDecl::getBitWidthValue(), clang::ASTRecordLayout::getDataSize(), clang::RecordType::getDecl(), 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::FieldDecl::isBitField(), isMsLayout(), PrintBitFieldOffset(), PrintIndentNoOffset(), PrintOffset(), clang::ASTContext::toBits(), and clang::ASTContext::toCharUnitsFromBits().
Referenced by clang::ASTContext::DumpRecordLayout(), and clang::ASTContext::getExnObjectAlignment().
|
static |
Definition at line 3158 of file RecordLayoutBuilder.cpp.
References clang::ASTContext::getASTRecordLayout(), clang::FieldDecl::getFieldIndex(), clang::ASTRecordLayout::getFieldOffset(), and clang::FieldDecl::getParent().
Referenced by clang::ASTContext::getExnObjectAlignment(), clang::ASTContext::getFieldOffset(), and getFieldSize().
|
static |
Get diagnostic select index for tag kind for field padding diagnostic message.
WARNING: Indexes apply to particular diagnostics only!
Definition at line 2024 of file RecordLayoutBuilder.cpp.
References Diag(), clang::TargetInfo::getCharWidth(), clang::NamedDecl::getIdentifier(), clang::Decl::getLocation(), clang::FieldDecl::getParent(), clang::TagDecl::getTagKind(), clang::ASTContext::getTargetInfo(), clang::ASTContext::getTypeDeclType(), clang::SourceLocation::isInvalid(), clang::TTK_Class, clang::TTK_Interface, and clang::TTK_Struct.
|
static |
Definition at line 2202 of file RecordLayoutBuilder.cpp.
References clang::TargetInfo::getCXXABI(), clang::ASTContext::getTargetInfo(), and clang::TargetCXXABI::isMicrosoft().
Referenced by clang::ASTContext::DumpRecordLayout(), DumpRecordLayout(), and clang::ASTContext::getASTRecordLayout().
|
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 2163 of file RecordLayoutBuilder.cpp.
References clang::TargetCXXABI::AlwaysUseTailPadding, clang::TargetCXXABI::getTailPaddingUseRules(), clang::CXXRecordDecl::isCXX11StandardLayout(), clang::CXXRecordDecl::isPOD(), clang::CXXRecordDecl::isTrivial(), clang::TargetCXXABI::UseTailPaddingUnlessPOD03, and clang::TargetCXXABI::UseTailPaddingUnlessPOD11.
|
static |
Definition at line 3267 of file RecordLayoutBuilder.cpp.
References clang::CharUnits::getQuantity().
Referenced by DumpRecordLayout().
|
static |
Definition at line 3285 of file RecordLayoutBuilder.cpp.
Referenced by DumpRecordLayout().
|
static |
Definition at line 3261 of file RecordLayoutBuilder.cpp.
References clang::CharUnits::getQuantity().
Referenced by DumpRecordLayout().
|
static |
Definition at line 2635 of file RecordLayoutBuilder.cpp.
References clang::CharUnits::alignTo(), clang::ASTRecordLayout::endsWithZeroSizedObject(), clang::RecordDecl::fields(), clang::CharUnits::fromQuantity(), clang::ASTContext::getASTRecordLayout(), clang::Decl::getAttr(), clang::FieldDecl::getBitWidthValue(), clang::ASTRecordLayout::getNonVirtualSize(), clang::ASTRecordLayout::getRequiredAlignment(), clang::Decl::hasAttr(), clang::FieldDecl::isBitField(), clang::CXXRecordDecl::isEmpty(), clang::CharUnits::isZero(), clang::ASTRecordLayout::leadsWithZeroSizedBase(), max(), min(), clang::LangOptions::MSVC2015, Offset, clang::ASTContext::toBits(), clang::ASTContext::toCharUnitsFromBits(), clang::CXXRecordDecl::vbases(), and clang::CharUnits::Zero().
|
static |
Definition at line 2939 of file RecordLayoutBuilder.cpp.
References clang::CXXRecordDecl::bases(), clang::ForVBaseOverride, clang::ForVFTable, clang::ASTContext::getASTRecordLayout(), clang::CXXRecordDecl::getMSVtorDispMode(), clang::CXXMethodDecl::getParent(), clang::ASTRecordLayout::getVBaseOffsetsMap(), clang::ASTRecordLayout::hasExtendableVFPtr(), clang::CXXRecordDecl::hasUserDeclaredConstructor(), clang::CXXRecordDecl::hasUserDeclaredDestructor(), clang::CXXRecordDecl::methods(), clang::Never, clang::CXXMethodDecl::overridden_methods(), and clang::CXXRecordDecl::vbases().
|
static |
Definition at line 1390 of file RecordLayoutBuilder.cpp.
References clang::TypeInfo::Align, clang::CharUnits::alignTo(), Diag(), clang::CharUnits::fromQuantity(), clang::Type::getAs(), clang::ASTContext::getAsArrayType(), clang::Type::getAsCXXRecordDecl(), clang::ASTContext::getASTRecordLayout(), clang::ASTContext::getBaseElementType(), clang::FieldDecl::getBitWidthValue(), clang::TargetInfo::getCharAlign(), clang::TargetInfo::getCharWidth(), clang::ASTRecordLayout::getDataSize(), clang::ArrayType::getElementType(), clang::NamedDecl::getIdentifier(), clang::ASTContext::getLangOpts(), clang::Decl::getLocation(), clang::Decl::getMaxAlignment(), clang::ASTRecordLayout::getNonVirtualSize(), clang::Type::getPointeeType(), clang::TargetInfo::getPointerAlign(), clang::TargetInfo::getPointerWidth(), clang::CharUnits::getQuantity(), clang::ASTContext::getTargetAddressSpace(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), clang::ValueDecl::getType(), clang::ASTContext::getTypeAlignInChars(), clang::ASTContext::getTypeDeclType(), clang::ASTContext::getTypeInfo(), clang::ASTContext::getTypeInfoInChars(), clang::ASTContext::getTypeSize(), clang::ASTContext::getTypeSizeInChars(), clang::TargetInfo::getZeroLengthBitfieldBoundary(), clang::Decl::hasAttr(), clang::FieldDecl::isBitField(), clang::CXXRecordDecl::isEmpty(), clang::Type::isIncompleteArrayType(), clang::QualType::isNull(), clang::CharUnits::isZero(), max(), min(), clang::CharUnits::One(), clang::ASTContext::toBits(), clang::ASTContext::toCharUnitsFromBits(), clang::ASTContext::UnsignedCharTy, clang::ASTContext::UnsignedIntTy, clang::ASTContext::UnsignedLongLongTy, clang::ASTContext::UnsignedLongTy, clang::ASTContext::UnsignedShortTy, clang::TargetInfo::useBitFieldTypeAlignment(), clang::TargetInfo::useExplicitBitFieldAlignment(), clang::TargetInfo::useZeroLengthBitfieldAlignment(), clang::TypeInfo::Width, and clang::CharUnits::Zero().