clang  6.0.0svn
Functions
RecordLayoutBuilder.cpp File Reference
#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/Format.h"
#include "llvm/Support/MathExtras.h"
Include dependency graph for RecordLayoutBuilder.cpp:

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 CXXMethodDeclcomputeKeyFunction (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)
 

Function Documentation

◆ computeKeyFunction()

static const CXXMethodDecl* computeKeyFunction ( ASTContext Context,
const CXXRecordDecl RD 
)
static

◆ DumpRecordLayout()

static void DumpRecordLayout ( raw_ostream &  OS,
const RecordDecl RD,
const ASTContext C,
CharUnits  Offset,
unsigned  IndentLevel,
const char *  Description,
bool  PrintSizeInfo,
bool  IncludeVirtualBases 
)
static

◆ getFieldOffset()

static uint64_t getFieldOffset ( const ASTContext C,
const FieldDecl FD 
)
static

◆ getPaddingDiagFromTagKind()

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!

Returns
diagnostic select index.

Definition at line 1937 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.

◆ isMsLayout()

static bool isMsLayout ( const ASTContext Context)
static

◆ mustSkipTailPadding()

static bool mustSkipTailPadding ( TargetCXXABI  ABI,
const CXXRecordDecl RD 
)
static

◆ PrintBitFieldOffset()

static void PrintBitFieldOffset ( raw_ostream &  OS,
CharUnits  Offset,
unsigned  Begin,
unsigned  Width,
unsigned  IndentLevel 
)
static

Definition at line 3163 of file RecordLayoutBuilder.cpp.

◆ PrintIndentNoOffset()

static void PrintIndentNoOffset ( raw_ostream &  OS,
unsigned  IndentLevel 
)
static

Definition at line 3181 of file RecordLayoutBuilder.cpp.

◆ PrintOffset()

static void PrintOffset ( raw_ostream &  OS,
CharUnits  Offset,
unsigned  IndentLevel 
)
static

Definition at line 3157 of file RecordLayoutBuilder.cpp.

References clang::CharUnits::getQuantity().

Referenced by DumpRecordLayout().

◆ recordUsesEBO()

static bool recordUsesEBO ( const RecordDecl RD)
static

◆ RequiresVtordisp()

static bool RequiresVtordisp ( const llvm::SmallPtrSetImpl< const CXXRecordDecl *> &  BasesWithOverriddenMethods,
const CXXRecordDecl RD 
)
static

◆ roundUpSizeToCharAlignment()

static uint64_t roundUpSizeToCharAlignment ( uint64_t  Size,
const ASTContext Context 
)
static

Definition at line 1365 of file RecordLayoutBuilder.cpp.

References clang::TypeInfo::Align, clang::CharUnits::alignTo(), Diag(), clang::CharUnits::fromQuantity(), clang::Type::getAs(), clang::ASTContext::getAsArrayType(), clang::ASTContext::getBaseElementType(), clang::FieldDecl::getBitWidthValue(), clang::TargetInfo::getCharAlign(), clang::TargetInfo::getCharWidth(), clang::ArrayType::getElementType(), clang::NamedDecl::getIdentifier(), clang::ASTContext::getLangOpts(), clang::Decl::getLocation(), clang::Decl::getMaxAlignment(), clang::Type::getPointeeType(), clang::TargetInfo::getPointerAlign(), clang::TargetInfo::getPointerWidth(), clang::CharUnits::getQuantity(), clang::ASTContext::getTargetAddressSpace(), clang::ASTContext::getTargetInfo(), 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().