clang
15.0.0git
|
CharUnits - This is an opaque type for sizes expressed in character units. More...
#include "clang/AST/CharUnits.h"
Public Types | |
typedef int64_t | QuantityType |
Public Member Functions | |
CharUnits ()=default | |
CharUnits - A default constructor. More... | |
CharUnits & | operator+= (const CharUnits &Other) |
CharUnits & | operator++ () |
CharUnits | operator++ (int) |
CharUnits & | operator-= (const CharUnits &Other) |
CharUnits & | operator-- () |
CharUnits | operator-- (int) |
bool | operator== (const CharUnits &Other) const |
bool | operator!= (const CharUnits &Other) const |
bool | operator< (const CharUnits &Other) const |
bool | operator<= (const CharUnits &Other) const |
bool | operator> (const CharUnits &Other) const |
bool | operator>= (const CharUnits &Other) const |
bool | isZero () const |
isZero - Test whether the quantity equals zero. More... | |
bool | isOne () const |
isOne - Test whether the quantity equals one. More... | |
bool | isPositive () const |
isPositive - Test whether the quantity is greater than zero. More... | |
bool | isNegative () const |
isNegative - Test whether the quantity is less than zero. More... | |
bool | isPowerOfTwo () const |
isPowerOfTwo - Test whether the quantity is a power of two. More... | |
bool | isMultipleOf (CharUnits N) const |
Test whether this is a multiple of the other value. More... | |
CharUnits | operator* (QuantityType N) const |
CharUnits & | operator*= (QuantityType N) |
CharUnits | operator/ (QuantityType N) const |
CharUnits & | operator/= (QuantityType N) |
QuantityType | operator/ (const CharUnits &Other) const |
CharUnits | operator% (QuantityType N) const |
QuantityType | operator% (const CharUnits &Other) const |
CharUnits | operator+ (const CharUnits &Other) const |
CharUnits | operator- (const CharUnits &Other) const |
CharUnits | operator- () const |
QuantityType | getQuantity () const |
getQuantity - Get the raw integer representation of this quantity. More... | |
llvm::Align | getAsAlign () const |
getAsAlign - Returns Quantity as a valid llvm::Align, Beware llvm::Align assumes power of two 8-bit bytes. More... | |
llvm::MaybeAlign | getAsMaybeAlign () const |
getAsMaybeAlign - Returns Quantity as a valid llvm::Align or llvm::None, Beware llvm::MaybeAlign assumes power of two 8-bit bytes. More... | |
CharUnits | alignTo (const CharUnits &Align) const |
alignTo - Returns the next integer (mod 2**64) that is greater than or equal to this quantity and is a multiple of Align . More... | |
CharUnits | alignmentAtOffset (CharUnits offset) const |
Given that this is a non-zero alignment value, what is the alignment at the given offset? More... | |
CharUnits | alignmentOfArrayElement (CharUnits elementSize) const |
Given that this is the alignment of the first element of an array, return the minimum alignment of any element in the array. More... | |
Static Public Member Functions | |
static CharUnits | Zero () |
Zero - Construct a CharUnits quantity of zero. More... | |
static CharUnits | One () |
One - Construct a CharUnits quantity of one. More... | |
static CharUnits | fromQuantity (QuantityType Quantity) |
fromQuantity - Construct a CharUnits quantity from a raw integer type. More... | |
CharUnits - This is an opaque type for sizes expressed in character units.
Instances of this type represent a quantity as a multiple of the size of the standard C type, char, on the target architecture. As an opaque type, CharUnits protects you from accidentally combining operations on quantities in bit units and character units.
In both C and C++, an object of type 'char', 'signed char', or 'unsigned char' occupies exactly one byte, so 'character unit' and 'byte' refer to the same quantity of storage. However, we use the term 'character unit' rather than 'byte' to avoid an implication that a character unit is exactly 8 bits.
For portability, never assume that a target character is 8 bits wide. Use CharUnit values wherever you calculate sizes, offsets, or alignments in character units.
Definition at line 38 of file CharUnits.h.
Definition at line 40 of file CharUnits.h.
|
default |
CharUnits - A default constructor.
Referenced by alignmentAtOffset(), alignTo(), fromQuantity(), One(), operator%(), operator*(), operator+(), operator++(), operator-(), operator--(), operator/(), and Zero().
Given that this is a non-zero alignment value, what is the alignment at the given offset?
Definition at line 200 of file CharUnits.h.
References CharUnits().
Referenced by alignmentOfArrayElement(), ApplyNonVirtualAndVirtualOffset(), clang::CodeGen::CodeGenFunction::EmitNewArrayInitializer(), and getArrayElementAlign().
Given that this is the alignment of the first element of an array, return the minimum alignment of any element in the array.
Definition at line 207 of file CharUnits.h.
References alignmentAtOffset().
Referenced by EmitArrayDelete(), clang::CodeGen::CodeGenFunction::EmitCXXAggrConstructorCall(), clang::CodeGen::CodeGenFunction::emitDestroy(), clang::CodeGen::CodeGenFunction::EmitNewArrayInitializer(), emitNonZeroVLAInit(), EmitOMPAggregateInit(), EmitOMPAggregateReduction(), forConstantArrayExpansion(), and getArrayElementAlign().
alignTo - Returns the next integer (mod 2**64) that is greater than or equal to this quantity and is a multiple of Align
.
Align must be non-zero.
Definition at line 194 of file CharUnits.h.
References CharUnits().
Referenced by clang::CodeGen::ConstantAggregateBuilderBase::addPlaceholderWithSize(), computeBlockInfo(), clang::CodeGen::CGOpenMPRuntime::emitDepobjDependClause(), emitVoidPtrDirectVAArg(), clang::CodeGen::CodeGenFunction::OMPBuilderCBHelpers::getAddressOfLocalVariable(), clang::CodeGen::CGOpenMPRuntime::getAddressOfLocalVariable(), and clang::CodeGen::CodeGenFunction::getBlockByrefInfo().
|
inlinestatic |
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Definition at line 63 of file CharUnits.h.
References CharUnits().
Referenced by clang::CodeGen::CodeGenFunction::AddInitializerToStaticVarDecl(), clang::CodeGen::ConstantAggregateBuilderBase::addPlaceholderWithSize(), CheckAggExprForMemSetUse(), createPlaceholderSlot(), DumpRecordLayout(), emitAddressAtOffset(), clang::CodeGen::CodeGenFunction::EmitARCStoreStrong(), clang::CodeGen::CodeGenFunction::EmitCall(), emitInterWarpCopyFunction(), clang::CodeGen::CGObjCRuntime::EmitValueForIvarAtOffset(), EmitX86_64VAArgFromMemory(), clang::CodeGen::CodeGenFunction::GenerateCXXGlobalInitFunc(), clang::CodeGen::CodeGenFunction::OMPBuilderCBHelpers::getAddressOfLocalVariable(), clang::CodeGen::CGOpenMPRuntime::getAddressOfLocalVariable(), clang::CodeGen::CodeGenModule::GetAddrOfConstantCFString(), clang::CodeGen::RValue::getAggregateAddress(), clang::CodeGen::AddressImpl< T, true >::getAlignment(), clang::CodeGen::LValue::getAlignment(), clang::CodeGen::CGFunctionInfo::getArgStructAlignment(), clang::ento::ElementRegion::getAsArrayOffset(), getBaseAlignmentAndOffsetFromLValue(), clang::CodeGen::CodeGenFunction::getBlockByrefInfo(), clang::CodeGen::swiftcall::SwiftAggLowering::getCoerceAndExpandTypes(), getConstantArrayInfoInChars(), clang::CodeGen::CodeGenFunction::getEHSelectorSlot(), llvm::DenseMapInfo< clang::BaseSubobject >::getEmptyKey(), llvm::DenseMapInfo< clang::CharUnits >::getEmptyKey(), clang::CodeGen::CodeGenFunction::ParamValue::getIndirectAddress(), clang::CodeGen::ABIArgInfo::getIndirectAlign(), clang::CodeGen::CodeGenTypeCache::getIntAlign(), clang::CodeGen::CodeGenTypeCache::getIntSize(), getLowBit(), getMaxAtomicAccessSize(), clang::CodeGen::swiftcall::getNaturalAlignment(), clang::CodeGen::CodeGenModule::getNaturalTypeAlignment(), clang::CodeGen::CGBlockInfo::Capture::getOffset(), getOffsetAtStartOfUnit(), getOffsetOfFullPath(), clang::CodeGen::CodeGenModule::getOMPAllocateAlignment(), clang::CodeGen::CodeGenTypeCache::getPointerAlign(), clang::CodeGen::CodeGenTypeCache::getPointerSize(), clang::CodeGen::CodeGenTypeCache::getSizeAlign(), clang::CodeGen::CodeGenTypeCache::getSizeSize(), llvm::DenseMapInfo< clang::BaseSubobject >::getTombstoneKey(), llvm::DenseMapInfo< clang::CharUnits >::getTombstoneKey(), getTypeAllocSize(), getTypeStoreSize(), initializeForBlockHeader(), isVarDeclStrongDefinition(), performTypeAdjustment(), clang::CodeGen::DominatingLLVMValue::save(), shuffleAndStore(), clang::analyze_os_log::OSLogBufferLayout::size(), clang::ASTContext::toCharUnitsFromBits(), and clang::ento::ExprEngine::VisitUnaryExprOrTypeTraitExpr().
|
inline |
getAsAlign - Returns Quantity as a valid llvm::Align, Beware llvm::Align assumes power of two 8-bit bytes.
Definition at line 183 of file CharUnits.h.
Referenced by buildGlobalBlock(), clang::CodeGen::CGBuilderTy::CreateAlignedStore(), CreateCoercedLoad(), CreateCoercedStore(), createLoadInstBefore(), clang::CodeGen::CGBuilderTy::CreateMemCpy(), clang::CodeGen::CGBuilderTy::CreateMemCpyInline(), clang::CodeGen::CGBuilderTy::CreateMemMove(), clang::CodeGen::CGBuilderTy::CreateMemSet(), clang::CodeGen::CGBuilderTy::CreateMemSetInline(), clang::CodeGen::CGBuilderTy::CreateStore(), createStoreInstBefore(), clang::CodeGen::CodeGenFunction::EmitCall(), clang::CodeGen::CodeGenFunction::EmitDeleteCall(), clang::CodeGen::CodeGenFunction::EmitFunctionProlog(), EmitNullBaseClassInitialization(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), clang::CodeGen::CodeGenFunction::EmitStaticVarDecl(), GenerateStringLiteral(), clang::CodeGen::CGOpenMPRuntimeGPU::getAddressOfLocalVariable(), clang::CodeGen::CodeGenModule::GetAddrOfConstantCString(), clang::CodeGen::CodeGenModule::GetAddrOfUnnamedGlobalConstantDecl(), getInitThreadEpochPtr(), and clang::CodeGen::CodeGenFunction::setBeforeOutermostConditional().
|
inline |
getAsMaybeAlign - Returns Quantity as a valid llvm::Align or llvm::None, Beware llvm::MaybeAlign assumes power of two 8-bit bytes.
Definition at line 187 of file CharUnits.h.
Referenced by clang::CodeGen::CodeGenFunction::EmitTypeCheck().
|
inline |
getQuantity - Get the raw integer representation of this quantity.
Definition at line 179 of file CharUnits.h.
Referenced by clang::Sema::AddAlignedAttr(), AddPointerLayoutOffset(), AddRelativeLayoutOffset(), clang::CodeGen::AddressImpl< T, true >::AddressImpl(), ApplyNonVirtualAndVirtualOffset(), clang::ASTContext::AtomicUsesUnsupportedLibcall(), buildBlockDescriptor(), buildGlobalBlock(), clang::Sema::BuildPredefinedExpr(), calculateOffset(), clang::ento::StoreManager::castRegion(), charUnitsToString(), clang::Sema::CheckAlignasUnderalignment(), clang::Sema::CheckCastAlign(), clang::Sema::CheckCXXThrowOperand(), computeBlockInfo(), clang::Sema::DefaultArgumentPromotion(), clang::CodeGen::ABIArgInfo::dump(), DumpRecordLayout(), clang::ento::RegionRawOffset::dumpToStream(), emitAlignedClause(), clang::CodeGen::CodeGenFunction::EmitArraySubscriptExpr(), clang::CodeGen::CodeGenFunction::EmitAsanPrologueOrEpilogue(), clang::CodeGen::CodeGenFunction::EmitAtomicExpr(), clang::CodeGen::CodeGenFunction::emitByrefStructureInit(), EmitCXXNewAllocSize(), clang::CodeGen::CodeGenFunction::EmitCXXNewExpr(), clang::CodeGen::CGOpenMPRuntime::emitDeclareSimdFunction(), clang::CodeGen::CodeGenFunction::EmitDeleteCall(), EmitISOVolatileLoad(), EmitISOVolatileStore(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), emitNonZeroVLAInit(), emitRoundPointerUpToAlignment(), clang::CodeGen::CodeGenFunction::EmitTypeCheck(), EvaluateComparisonBinaryOperator(), clang::Sema::FillInlineAsmIdentifierInfo(), clang::Sema::FinalizeDeclaration(), clang::CodeGen::CodeGenFunction::ParamValue::forIndirect(), clang::CodeGen::CodeGenTBAA::getAccessInfo(), clang::CodeGen::CodeGenModule::GetAddrOfConstantCString(), clang::CodeGen::RValue::getAggregate(), clang::CodeGen::CodeGenFunction::getBlockByrefInfo(), getConstantArrayInfoInChars(), llvm::DenseMapInfo< clang::CharUnits >::getHashValue(), clang::CodeGen::swiftcall::getNaturalAlignment(), clang::CodeGen::CodeGenModule::getNaturalTypeAlignment(), getOffsetAtStartOfUnit(), clang::CodeGen::CodeGenModule::getOMPAllocateAlignment(), clang::CodeGen::CGOpenCLRuntime::getPipeElemAlign(), clang::CodeGen::CGOpenCLRuntime::getPipeElemSize(), clang::CodeGen::CGBuilderTy::getSize(), clang::CodeGen::CodeGenModule::getSize(), clang::analyze_os_log::OSLogBufferItem::getSizeByte(), HandleOperatorNewCall(), initializeForBlockHeader(), clang::CodeGen::SwiftABIInfo::isLegalVectorTypeForSwift(), clang::CodeGen::CGBlockInfo::Capture::makeIndex(), clang::CodeGen::CGBitFieldInfo::print(), clang::CodeGen::BlockByrefHelpers::Profile(), clang::CodeGen::CodeGenModule::Release(), scaleValue(), clang::CodeGen::LValue::setAddress(), clang::CodeGen::LValue::setAlignment(), clang::CodeGen::CGFunctionInfo::setArgStruct(), clang::CodeGen::ABIArgInfo::setIndirectAlign(), setUsedBits(), clang::ASTContext::toBits(), and clang::ento::ExprEngine::VisitUnaryExprOrTypeTraitExpr().
Test whether this is a multiple of the other value.
Among other things, this promises that self.alignTo(N) will just return self.
Definition at line 137 of file CharUnits.h.
|
inline |
isNegative - Test whether the quantity is less than zero.
Definition at line 125 of file CharUnits.h.
Referenced by EmitNullBaseClassInitialization(), and evenFlexibleArraySize().
|
inline |
isOne - Test whether the quantity equals one.
Definition at line 119 of file CharUnits.h.
Referenced by clang::Sema::CheckCastAlign(), EmitCXXNewAllocSize(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), clang::Sema::RefersToMemberWithReducedAlignment(), and clang::CodeGen::EHCleanupScope::setActiveFlag().
|
inline |
isPositive - Test whether the quantity is greater than zero.
Definition at line 122 of file CharUnits.h.
Referenced by clang::ASTContext::getObjCEncodingTypeSize().
|
inline |
isPowerOfTwo - Test whether the quantity is a power of two.
Zero is not a power of two.
Definition at line 129 of file CharUnits.h.
Referenced by clang::CodeGen::AddressImpl< T, true >::AddressImpl().
|
inline |
isZero - Test whether the quantity equals zero.
Definition at line 116 of file CharUnits.h.
Referenced by clang::CodeGen::AddressImpl< T, true >::AddressImpl(), ApplyNonVirtualAndVirtualOffset(), clang::ento::StoreManager::castRegion(), castValueToType(), clang::Sema::CheckSubtractionOperands(), clang::CodeGen::CodeGenFunction::EmitARCStoreStrong(), clang::CodeGen::CodeGenFunction::EmitDeleteCall(), EmitNullBaseClassInitialization(), EmitNullConstant(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), clang::CodeGen::CodeGenFunction::EmitVTableAssumptionLoad(), EvaluateBuiltinConstantPForLValue(), evenFlexibleArraySize(), clang::CodeGen::CodeGenFunction::ParamValue::forIndirect(), clang::CodeGen::CodeGenFunction::GetAddressOfBaseClass(), GetAddrOfVTTVTable(), clang::CodeGen::CodeGenFunction::InitializeVTablePointer(), clang::CodeGen::CodeGenFunction::LoadCXXThisAddress(), and clang::CodeGen::CGOpenMPRuntime::registerTargetGlobalVariable().
|
inlinestatic |
One - Construct a CharUnits quantity of one.
Definition at line 58 of file CharUnits.h.
References CharUnits().
Referenced by clang::CodeGen::CodeGenFunction::createCleanupActiveFlag(), clang::CodeGen::CGBuilderTy::CreateFlagStore(), clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(), EmitBitTestIntrinsic(), emitTlsGuardCheck(), clang::CodeGen::swiftcall::SwiftAggLowering::finish(), clang::CodeGen::CodeGenModule::getClassPointerAlignment(), clang::CodeGen::CodeGenModule::getMinimumClassObjectSize(), clang::CodeGen::CodeGenModule::getNaturalTypeAlignment(), and SetupCleanupBlockActivation().
Definition at line 95 of file CharUnits.h.
|
inline |
Definition at line 162 of file CharUnits.h.
|
inline |
Definition at line 159 of file CharUnits.h.
References CharUnits().
|
inline |
Definition at line 142 of file CharUnits.h.
References CharUnits().
|
inline |
Definition at line 145 of file CharUnits.h.
Definition at line 165 of file CharUnits.h.
References CharUnits().
|
inline |
Definition at line 72 of file CharUnits.h.
Definition at line 76 of file CharUnits.h.
References CharUnits().
Definition at line 68 of file CharUnits.h.
|
inline |
Definition at line 171 of file CharUnits.h.
References CharUnits().
Definition at line 168 of file CharUnits.h.
References CharUnits().
|
inline |
Definition at line 83 of file CharUnits.h.
Definition at line 87 of file CharUnits.h.
References CharUnits().
Definition at line 79 of file CharUnits.h.
|
inline |
Definition at line 156 of file CharUnits.h.
|
inline |
Definition at line 149 of file CharUnits.h.
References CharUnits().
|
inline |
Definition at line 152 of file CharUnits.h.
Definition at line 100 of file CharUnits.h.
Definition at line 103 of file CharUnits.h.
Definition at line 92 of file CharUnits.h.
Definition at line 106 of file CharUnits.h.
Definition at line 109 of file CharUnits.h.
|
inlinestatic |
Zero - Construct a CharUnits quantity of zero.
Definition at line 53 of file CharUnits.h.
References CharUnits().
Referenced by clang::CodeGen::swiftcall::SwiftAggLowering::addTypedData(), BuildAppleKextVirtualCall(), CalculateCookiePadding(), classifyType(), computeBlockInfo(), clang::CodeGen::CodeGenModule::computeNonVirtualBaseClassOffset(), clang::CodeGen::CodeGenFunction::defaultInitNonTrivialCStructVar(), DiagnoseReinterpretUpDownCast(), clang::CodeGen::CodeGenFunction::EmitCXXConstructorCall(), clang::CodeGen::CodeGenFunction::EmitMemberExpr(), EmitNullBaseClassInitialization(), clang::SourceLocExpr::EvaluateInContext(), getAlignmentAndOffsetFromBinAddOrSub(), clang::CodeGen::CGCXXABI::GetArrayCookieSize(), clang::CodeGen::CGCXXABI::getArrayCookieSizeImpl(), getBaseAlignmentAndOffsetFromLValue(), getBaseAlignmentAndOffsetFromPtr(), clang::CodeGen::swiftcall::SwiftAggLowering::getCoerceAndExpandTypes(), getDerivedToBaseAlignmentAndOffset(), clang::VarDecl::getFlexibleArrayInitChars(), clang::ASTContext::getMemberPointerPathAdjustment(), GetNumNonZeroBytesInInit(), clang::ASTContext::getObjCEncodingTypeSize(), clang::ASTContext::getOffsetOfBaseWithVBPtr(), getOffsetOfFullPath(), getTypeExpansion(), clang::CodeGen::CGCXXABI::getVirtualFunctionPrologueThisAdjustment(), clang::CodeGen::CodeGenFunction::getVTablePointers(), clang::CodeGen::CodeGenFunction::InitializeVTablePointer(), clang::CodeGen::CGCXXABI::ReadArrayCookie(), clang::CodeGen::CGOpenMPRuntime::registerTargetGlobalVariable(), selectBestPath(), clang::interp::Pointer::toAPValue(), and clang::VTTBuilder::VTTBuilder().