clang
9.0.0
|
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... | |
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 37 of file CharUnits.h.
typedef int64_t clang::CharUnits::QuantityType |
Definition at line 39 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 189 of file CharUnits.h.
References CharUnits().
Referenced by alignmentOfArrayElement(), ApplyNonVirtualAndVirtualOffset(), buildByrefHelpers(), getArrayElementAlign(), and getBlockCaptureStr().
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 196 of file CharUnits.h.
References alignmentAtOffset().
Referenced by EmitArrayDelete(), clang::CodeGen::CodeGenFunction::emitDestroy(), clang::CodeGen::CodeGenFunction::EmitNewArrayInitializer(), emitNonZeroVLAInit(), EmitOMPAggregateInit(), EmitOMPAggregateReduction(), forConstantArrayExpansion(), getArrayElementAlign(), isSimpleZero(), isTrivialFiller(), and clang::CodeGen::CodeGenFunction::isTrivialInitializer().
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 183 of file CharUnits.h.
References CharUnits().
Referenced by computeBlockInfo(), clang::CodeGen::CGOpenMPRuntime::emitCall(), emitVoidPtrDirectVAArg(), clang::CodeGen::CodeGenFunction::getBlockByrefInfo(), getTypeString(), isRecordWithSSEVectorType(), recordUsesEBO(), and roundUpSizeToCharAlignment().
|
inlinestatic |
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Definition at line 62 of file CharUnits.h.
References CharUnits().
Referenced by CheckAggExprForMemSetUse(), convertUnsignedAPIntToCharUnits(), createPlaceholderSlot(), CreateTempAllocaForCoercion(), DumpRecordLayout(), emitAddressAtOffset(), clang::CodeGen::CodeGenFunction::EmitARCStoreStrong(), clang::CodeGen::CodeGenFunction::EmitBlockLiteral(), clang::CodeGen::CGOpenMPRuntime::emitCall(), clang::CodeGen::CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(), emitInterWarpCopyFunction(), clang::CodeGen::CGOpenMPRuntimeNVPTX::emitTeamsOutlinedFunction(), clang::CodeGen::CGObjCRuntime::EmitValueForIvarAtOffset(), EmitX86_64VAArgFromMemory(), EvaluatePointer(), evenFlexibleArraySize(), FindIvarInterface(), clang::CodeGen::CodeGenFunction::GenerateCXXGlobalInitFunc(), clang::CodeGen::CodeGenModule::GetAddrOfConstantCFString(), GetAlignOfExpr(), clang::CodeGen::CGFunctionInfo::getArgStructAlignment(), clang::ento::ElementRegion::getAsArrayOffset(), clang::CodeGen::CodeGenFunction::getBlockByrefInfo(), getBlockLayoutInfoString(), clang::CodeGen::swiftcall::SwiftAggLowering::getCoerceAndExpandTypes(), GetConstantStringEntry(), clang::CodeGen::CodeGenFunction::getEHSelectorSlot(), llvm::DenseMapInfo< clang::BaseSubobject >::getEmptyKey(), llvm::DenseMapInfo< clang::CharUnits >::getEmptyKey(), GetGCAttrTypeForType(), clang::VTableComponent::getGlobalDecl(), clang::CodeGen::ABIArgInfo::getIndirectAlign(), getLowBit(), getMaxAtomicAccessSize(), clang::CodeGen::swiftcall::getNaturalAlignment(), clang::CodeGen::CodeGenFunction::getNaturalTypeAlignment(), getOffsetAtStartOfUnit(), llvm::DenseMapInfo< clang::BaseSubobject >::getTombstoneKey(), llvm::DenseMapInfo< clang::CharUnits >::getTombstoneKey(), getTypeAllocSize(), getTypeStoreSize(), getTypeString(), initializeForBlockHeader(), isArgInAlloca(), isRecordWithSSEVectorType(), isVarDeclStrongDefinition(), performTypeAdjustment(), recordUsesEBO(), roundUpSizeToCharAlignment(), shuffleAndStore(), clang::analyze_os_log::OSLogBufferLayout::size(), clang::ASTContext::toCharUnitsFromBits(), tryEvaluateBuiltinObjectSize(), and clang::ento::ExprEngine::VisitUnaryExprOrTypeTraitExpr().
|
inline |
getQuantity - Get the raw integer representation of this quantity.
Definition at line 178 of file CharUnits.h.
Referenced by clang::CodeGen::CodeGenModule::AddVTableTypeMetadata(), ApplyNonVirtualAndVirtualOffset(), clang::ASTContext::AtomicUsesUnsupportedLibcall(), buildBlockDescriptor(), buildGlobalBlock(), buildMemcpyForAssignmentOp(), calculateOffset(), clang::ento::StoreManager::castRegion(), charUnitsToString(), CheckAggExprForMemSetUse(), clang::CodeGen::CGOpenMPRuntimeNVPTX::clear(), computeBlockInfo(), ComputeVMIClassTypeInfoFlags(), clang::CodeGen::CodeGenModule::ConstructAttributeList(), ContainsFloatAtOffset(), clang::CodeGen::CGBuilderTy::CreateAlignedStore(), createLoadInstBefore(), clang::CodeGen::CGBuilderTy::CreateMemCpy(), clang::CodeGen::CGBuilderTy::CreateMemMove(), clang::CodeGen::CGBuilderTy::CreateMemSet(), createRuntimeShuffleFunction(), clang::CodeGen::CGBuilderTy::CreateStore(), createStoreInstBefore(), decomposeTypeForEH(), detectAmbiguousBases(), DiagnoseBadFunctionCast(), DumpRecordLayout(), emitAlignedClause(), clang::CodeGen::CodeGenFunction::EmitArraySubscriptExpr(), clang::CodeGen::CodeGenFunction::EmitAsanPrologueOrEpilogue(), clang::CodeGen::CodeGenFunction::EmitAtomicExpr(), clang::CodeGen::CodeGenFunction::EmitConstructorBody(), EmitCXXNewAllocSize(), clang::CodeGen::CodeGenFunction::EmitCXXNewExpr(), clang::CodeGen::CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(), clang::CodeGen::CodeGenFunction::emitImplicitAssignmentOperatorBody(), emitInterWarpCopyFunction(), clang::CodeGen::CodeGenFunction::EmitInvariantStart(), EmitISOVolatileLoad(), EmitISOVolatileStore(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), emitNonZeroVLAInit(), emitRoundPointerUpToAlignment(), emitRTtypeidCall(), clang::CodeGen::CodeGenFunction::EmitStaticVarDecl(), clang::CodeGen::CGOpenMPRuntimeNVPTX::emitTeamsOutlinedFunction(), clang::CodeGen::CodeGenFunction::EmitTypeCheck(), EmitX86_64VAArgFromMemory(), EvaluateComparisonBinaryOperator(), FindIvarInterface(), clang::CodeGen::AggValueSlot::forAddr(), clang::CodeGen::CodeGenFunction::ParamValue::forIndirect(), clang::CodeGen::CodeGenVTables::GenerateConstructionVTable(), GenerateStringLiteral(), clang::CodeGen::CodeGenTBAA::getAccessInfo(), clang::CodeGen::RValue::getAggregate(), GetAlignOfExpr(), clang::ento::ElementRegion::getAsArrayOffset(), getBadTypeidFn(), clang::CodeGen::CodeGenFunction::getBlockByrefInfo(), getBlockDescriptorName(), getCopyDestroyHelperFuncName(), clang::ento::TypedValueRegion::getExtent(), GetGCAttrTypeForType(), clang::VTableComponent::getGlobalDecl(), llvm::DenseMapInfo< clang::CharUnits >::getHashValue(), getInitThreadEpochPtr(), getLowBit(), clang::CodeGen::swiftcall::getNaturalAlignment(), clang::CodeGen::CodeGenFunction::getNaturalTypeAlignment(), clang::CodeGen::CodeGenModule::GetNonVirtualBaseClassOffset(), getOffsetAtStartOfUnit(), clang::CodeGen::CGBuilderTy::getSize(), clang::CodeGen::CodeGenModule::getSize(), clang::analyze_os_log::OSLogBufferItem::getSizeByte(), clang::CodeGen::CodeGenTBAA::getTBAAStructInfo(), getThreadLocalWrapperLinkage(), getTypeInfoVTable(), getTypeString(), getUsualDeleteParams(), clang::CodeGen::CodeGenTBAA::getVTablePtrAccessInfo(), HandleConstructorCall(), hasDefaultCXXMethodCC(), hasMRCWeakIvars(), initializeForBlockHeader(), clang::CodeGen::CodeGenFunction::InitTempAlloca(), clang::CodeGen::ConstantInitFuture::installInGlobal(), isFullSizeType(), clang::CodeGen::SwiftABIInfo::isLegalVectorTypeForSwift(), isRecordWithSSEVectorType(), isTrivialFiller(), clang::CodeGen::CodeGenFunction::isTrivialInitializer(), isValidBaseType(), clang::CodeGen::CodeGenFunction::LoadPassedObjectSize(), clang::CodeGen::CGBlockInfo::Capture::makeIndex(), clang::CodeGen::CGBitFieldInfo::print(), PrintBitFieldOffset(), PrintOffset(), clang::APValue::printPretty(), clang::CodeGen::BlockByrefHelpers::Profile(), roundUpSizeToCharAlignment(), scaleValue(), clang::CodeGen::LValue::setAddress(), clang::CodeGen::LValue::setAlignment(), clang::CodeGen::CGFunctionInfo::setArgStruct(), clang::CodeGen::CodeGenFunction::setBeforeOutermostConditional(), clang::CodeGen::ABIArgInfo::setIndirectAlign(), shuffleAndStore(), clang::ASTContext::toBits(), treatUnusedNewEscaped(), tryEvaluateBuiltinObjectSize(), clang::ento::ExprEngine::VisitUnaryExprOrTypeTraitExpr(), and Write__ivar_list_t_initializer().
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 136 of file CharUnits.h.
Referenced by clang::CodeGen::swiftcall::SwiftAggLowering::addTypedData(), getTypeString(), and isRecordWithSSEVectorType().
|
inline |
isNegative - Test whether the quantity is less than zero.
Definition at line 124 of file CharUnits.h.
Referenced by EmitNullBaseClassInitialization(), and evenFlexibleArraySize().
|
inline |
isOne - Test whether the quantity equals one.
Definition at line 118 of file CharUnits.h.
Referenced by EmitCXXNewAllocSize(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), clang::CodeGen::CodeGenFunction::isTrivialInitializer(), clang::CodeGen::EHCleanupScope::setActiveFlag(), and tryEmitFMulAdd().
|
inline |
isPositive - Test whether the quantity is greater than zero.
Definition at line 121 of file CharUnits.h.
Referenced by clang::ASTContext::getObjCEncodingTypeSize(), and hasDefaultCXXMethodCC().
|
inline |
isPowerOfTwo - Test whether the quantity is a power of two.
Zero is not a power of two.
Definition at line 128 of file CharUnits.h.
Referenced by tryEvaluateBuiltinObjectSize().
|
inline |
isZero - Test whether the quantity equals zero.
Definition at line 115 of file CharUnits.h.
Referenced by clang::CodeGen::Address::Address(), clang::CodeGen::swiftcall::SwiftAggLowering::addTypedData(), ApplyNonVirtualAndVirtualOffset(), clang::ento::StoreManager::castRegion(), castValueToType(), clang::CodeGen::CodeGenModule::ConstructAttributeList(), DiagnoseReinterpretUpDownCast(), emitAddrOfZeroSizeField(), clang::CodeGen::CodeGenFunction::EmitARCStoreStrong(), clang::CodeGen::CodeGenFunction::EmitDeleteCall(), EmitNullBaseClassInitialization(), EmitNullConstant(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), clang::CodeGen::CodeGenFunction::EmitVTableAssumptionLoad(), EvalPointerValueAsBool(), EvaluateBuiltinConstantPForLValue(), EvaluateComparisonBinaryOperator(), evenFlexibleArraySize(), clang::CodeGen::CodeGenFunction::ParamValue::forIndirect(), clang::CodeGen::CodeGenFunction::GetAddressOfBaseClass(), GetAddrOfVTTVTable(), clang::CodeGen::CodeGenModule::GetNonVirtualBaseClassOffset(), getTypeString(), hasDefaultCXXMethodCC(), clang::CodeGen::CodeGenFunction::InitializeVTablePointer(), clang::CodeGen::CodeGenFunction::isTrivialInitializer(), performTypeAdjustment(), recordUsesEBO(), clang::CodeGen::registerTargetGlobalVariable(), and roundUpSizeToCharAlignment().
|
inlinestatic |
One - Construct a CharUnits quantity of one.
Definition at line 57 of file CharUnits.h.
References CharUnits().
Referenced by clang::CodeGen::swiftcall::SwiftAggLowering::addTypedData(), clang::CodeGen::CGBuilderTy::CreateFlagStore(), clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(), EmitBitTestIntrinsic(), clang::CodeGen::swiftcall::SwiftAggLowering::finish(), GetAlignOfExpr(), GetAlignOfType(), clang::CodeGen::CodeGenModule::getClassPointerAlignment(), clang::CodeGen::CodeGenFunction::getNaturalTypeAlignment(), getThreadLocalWrapperLinkage(), HandleSizeof(), isBlockVarRef(), isMergeableEntryType(), isSimpleZero(), roundUpSizeToCharAlignment(), SetupCleanupBlockActivation(), tryEmitFMulAdd(), and tryEvaluateBuiltinObjectSize().
Definition at line 94 of file CharUnits.h.
|
inline |
Definition at line 158 of file CharUnits.h.
References CharUnits().
|
inline |
Definition at line 161 of file CharUnits.h.
|
inline |
Definition at line 141 of file CharUnits.h.
References CharUnits().
|
inline |
Definition at line 144 of file CharUnits.h.
Definition at line 164 of file CharUnits.h.
References CharUnits().
|
inline |
Definition at line 71 of file CharUnits.h.
|
inline |
Definition at line 75 of file CharUnits.h.
References CharUnits().
Definition at line 67 of file CharUnits.h.
Definition at line 167 of file CharUnits.h.
References CharUnits().
|
inline |
Definition at line 170 of file CharUnits.h.
References CharUnits().
|
inline |
Definition at line 82 of file CharUnits.h.
|
inline |
Definition at line 86 of file CharUnits.h.
References CharUnits().
Definition at line 78 of file CharUnits.h.
|
inline |
Definition at line 148 of file CharUnits.h.
References CharUnits().
|
inline |
Definition at line 155 of file CharUnits.h.
|
inline |
Definition at line 151 of file CharUnits.h.
Definition at line 99 of file CharUnits.h.
Definition at line 102 of file CharUnits.h.
Definition at line 91 of file CharUnits.h.
Definition at line 105 of file CharUnits.h.
Definition at line 108 of file CharUnits.h.
|
inlinestatic |
Zero - Construct a CharUnits quantity of zero.
Definition at line 52 of file CharUnits.h.
References CharUnits().
Referenced by BuildAppleKextVirtualCall(), CalculateCookiePadding(), classifyType(), computeBlockInfo(), clang::CodeGen::CodeGenModule::computeNonVirtualBaseClassOffset(), createNullAddressArray(), DiagnoseReinterpretUpDownCast(), clang::CodeGen::CodeGenFunction::EmitArraySubscriptExpr(), clang::CodeGen::CodeGenFunction::EmitCXXConstructorCall(), clang::CodeGen::CodeGenFunction::EmitMemberExpr(), EmitNullBaseClassInitialization(), clang::CodeGen::CodeGenFunction::EmitOMPArraySectionExpr(), clang::CodeGen::CGCXXABI::GetArrayCookieSize(), clang::CodeGen::CGCXXABI::getArrayCookieSizeImpl(), getBlockLayoutInfoString(), clang::CodeGen::swiftcall::SwiftAggLowering::getCoerceAndExpandTypes(), getFieldSize(), GetGCAttrTypeForType(), clang::CodeGen::CGCXXABI::getMemberPointerPathAdjustment(), GetNumNonZeroBytesInInit(), clang::ASTContext::getObjCEncodingTypeSize(), clang::ASTContext::getOffsetOfBaseWithVBPtr(), getTypeExpansion(), getTypeString(), clang::CodeGen::CodeGenFunction::getVTablePointers(), hasDefaultCXXMethodCC(), hasMRCWeakIvars(), clang::CodeGen::CodeGenFunction::InitializeVTablePointer(), clang::CodeGen::CGCXXABI::ReadArrayCookie(), recordUsesEBO(), clang::CodeGen::registerTargetGlobalVariable(), roundUpSizeToCharAlignment(), and clang::VTTBuilder::VTTBuilder().