clang API Documentation
#include <CharUnits.h>
Public Types | |
typedef int64_t | QuantityType |
Public Member Functions | |
CharUnits () | |
CharUnits - A default constructor. | |
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. | |
bool | isOne () const |
isOne - Test whether the quantity equals one. | |
bool | isPositive () const |
isPositive - Test whether the quantity is greater than zero. | |
bool | isNegative () const |
isNegative - Test whether the quantity is less than zero. | |
bool | isPowerOfTwo () const |
CharUnits | operator* (QuantityType N) const |
CharUnits | operator/ (QuantityType N) const |
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. | |
CharUnits | RoundUpToAlignment (const CharUnits &Align) const |
CharUnits | alignmentAtOffset (CharUnits offset) |
Static Public Member Functions | |
static CharUnits | Zero () |
Zero - Construct a CharUnits quantity of zero. | |
static CharUnits | One () |
One - Construct a CharUnits quantity of one. | |
static CharUnits | fromQuantity (QuantityType Quantity) |
fromQuantity - Construct a CharUnits quantity from a raw integer type. |
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.
typedef int64_t clang::CharUnits::QuantityType |
Definition at line 40 of file CharUnits.h.
clang::CharUnits::CharUnits | ( | ) | [inline] |
CharUnits - A default constructor.
Definition at line 50 of file CharUnits.h.
Referenced by alignmentAtOffset(), fromQuantity(), One(), operator%(), operator*(), operator+(), operator++(), operator-(), operator--(), operator/(), RoundUpToAlignment(), and Zero().
CharUnits clang::CharUnits::alignmentAtOffset | ( | CharUnits | offset | ) | [inline] |
Given that this is a non-zero alignment value, what is the alignment at the given offset?
Definition at line 175 of file CharUnits.h.
References CharUnits().
static CharUnits clang::CharUnits::fromQuantity | ( | QuantityType | Quantity | ) | [inline, static] |
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Definition at line 63 of file CharUnits.h.
References CharUnits().
Referenced by buildByrefHelpers(), CheckAggExprForMemSetUse(), computeOffsetHint(), DumpCXXRecordLayout(), clang::CodeGen::CodeGenFunction::EmitARCStoreStrong(), clang::CodeGen::CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::LValue::getAlignment(), clang::CodeGen::AggValueSlot::getAlignment(), clang::ASTContext::getASTRecordLayout(), getConstantArrayInfoInChars(), llvm::DenseMapInfo< clang::BaseSubobject >::getEmptyKey(), llvm::DenseMapInfo< clang::CharUnits >::getEmptyKey(), getLowBit(), getMaxAtomicAccessSize(), llvm::DenseMapInfo< clang::BaseSubobject >::getTombstoneKey(), llvm::DenseMapInfo< clang::CharUnits >::getTombstoneKey(), clang::CodeGen::CGBitFieldInfo::MakeInfo(), clang::CodeGen::CodeGenFunction::MakeNaturalAlignAddrLValue(), clang::ASTContext::toCharUnitsFromBits(), and clang::ento::ExprEngine::VisitUnaryExprOrTypeTraitExpr().
QuantityType clang::CharUnits::getQuantity | ( | ) | const [inline] |
getQuantity - Get the raw integer representation of this quantity.
Definition at line 163 of file CharUnits.h.
Referenced by AddDirectArgument(), ApplyNonVirtualAndVirtualOffset(), clang::ASTContext::AtomicUsesUnsupportedLibcall(), buildBlockDescriptor(), clang::CodeGen::CodeGenFunction::BuildByRefType(), buildGlobalBlock(), buildMemcpyForAssignmentOp(), clang::Sema::BuildPredefinedExpr(), clang::ento::StoreManager::castRegion(), charUnitsToString(), CheckAggExprForMemSetUse(), clang::Sema::CheckAlignasUnderalignment(), clang::Sema::CheckCastAlign(), computeBlockInfo(), clang::CodeGen::CodeGenFunction::CreateIRTemp(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CodeGenVTables::CreateVTableInitializer(), clang::Sema::DiagnoseSizeOfParametersAndReturnValue(), DumpCXXRecordLayout(), clang::ento::RegionRawOffset::dumpToStream(), clang::CodeGen::CodeGenFunction::EmitAggregateCopy(), clang::CodeGen::CodeGenFunction::EmitArraySubscriptExpr(), clang::CodeGen::CodeGenFunction::EmitAsanPrologueOrEpilogue(), clang::CodeGen::CodeGenFunction::EmitAtomicExpr(), clang::CodeGen::CodeGenFunction::EmitAtomicLoad(), clang::CodeGen::CodeGenFunction::EmitAtomicStore(), clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(), clang::CodeGen::CodeGenFunction::EmitAutoVarInit(), clang::CodeGen::CodeGenFunction::EmitBlockLiteral(), clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), clang::CodeGen::CodeGenFunction::emitByrefStructureInit(), clang::CodeGen::CodeGenFunction::EmitCall(), clang::CodeGen::CodeGenModule::EmitConstantValue(), clang::CodeGen::CodeGenFunction::EmitCXXGlobalVarDeclInit(), EmitCXXNewAllocSize(), clang::CodeGen::CodeGenFunction::EmitCXXThrowExpr(), clang::CodeGen::CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(), EmitDeclInvariant(), clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(), clang::CodeGen::CodeGenFunction::EmitDeleteCall(), clang::CodeGen::CodeGenFunction::EmitFunctionProlog(), EmitGlobalVarDeclLValue(), clang::CodeGen::CodeGenFunction::EmitLoadOfExtVectorElementLValue(), clang::CodeGen::CodeGenFunction::EmitLoadOfLValue(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitNewArrayInitializer(), EmitNullBaseClassInitialization(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), clang::CodeGen::CodeGenFunction::EmitParmDecl(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(), clang::CodeGen::CodeGenFunction::EmitStoreThroughLValue(), clang::CodeGen::CodeGenFunction::EmitTypeCheck(), clang::CodeGen::CGObjCRuntime::EmitValueForIvarAtOffset(), clang::CodeGen::AggValueSlot::forAddr(), clang::CodeGen::CodeGenFunction::GenerateBlockFunction(), clang::CodeGen::CodeGenVTables::GenerateConstructionVTable(), clang::CodeGen::CodeGenModule::GetAddrOfConstantCFString(), clang::CodeGen::CodeGenModule::GetAddrOfConstantCString(), clang::CodeGen::CodeGenModule::GetAddrOfConstantString(), clang::ento::MemRegion::getAsOffset(), clang::ento::TypedValueRegion::getExtent(), llvm::DenseMapInfo< clang::CharUnits >::getHashValue(), getLowBit(), clang::CodeGen::CodeGenModule::GetNonVirtualBaseClassOffset(), clang::ConstantArrayType::getNumAddressingBits(), clang::CodeGen::CodeGenModule::getSize(), clang::Sema::LookupInlineAsmField(), clang::Sema::LookupInlineAsmIdentifier(), clang::CodeGen::CodeGenFunction::MakeNaturalAlignAddrLValue(), mergeAlignedAttrs(), PrintOffset(), clang::CodeGen::CodeGenModule::ByrefHelpers::Profile(), clang::CodeGen::CGCXXABI::ReadArrayCookie(), scaleValue(), clang::CodeGen::LValue::setAlignment(), clang::ASTContext::toBits(), and clang::ento::ExprEngine::VisitUnaryExprOrTypeTraitExpr().
bool clang::CharUnits::isNegative | ( | ) | const [inline] |
isNegative - Test whether the quantity is less than zero.
Definition at line 125 of file CharUnits.h.
Referenced by evenFlexibleArraySize().
bool clang::CharUnits::isOne | ( | ) | const [inline] |
isOne - Test whether the quantity equals one.
Definition at line 119 of file CharUnits.h.
Referenced by clang::Sema::CheckCastAlign(), EmitCXXNewAllocSize(), and clang::CodeGen::CodeGenFunction::EmitNullInitialization().
bool clang::CharUnits::isPositive | ( | ) | const [inline] |
isPositive - Test whether the quantity is greater than zero.
Definition at line 122 of file CharUnits.h.
Referenced by clang::ASTContext::getObjCEncodingForBlock(), clang::ASTContext::getObjCEncodingForFunctionDecl(), clang::ASTContext::getObjCEncodingForMethodDecl(), and clang::ASTContext::getObjCEncodingTypeSize().
bool clang::CharUnits::isPowerOfTwo | ( | ) | const [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.
bool clang::CharUnits::isZero | ( | ) | const [inline] |
isZero - Test whether the quantity equals zero.
Definition at line 116 of file CharUnits.h.
Referenced by clang::Sema::ActOnFields(), ApplyNonVirtualAndVirtualOffset(), clang::ento::StoreManager::castRegion(), clang::Sema::CheckSubtractionOperands(), DiagnoseReinterpretUpDownCast(), clang::CodeGen::CodeGenFunction::EmitAggregateCopy(), clang::CodeGen::CodeGenFunction::EmitARCStoreStrong(), clang::CodeGen::CodeGenFunction::EmitArraySubscriptExpr(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitLValueForFieldInitialization(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), EvalPointerValueAsBool(), evenFlexibleArraySize(), clang::CodeGen::CodeGenFunction::GetAddressOfBaseClass(), GetAddrOfVTTVTable(), clang::CodeGen::CodeGenModule::GetNonVirtualBaseClassOffset(), clang::ASTContext::getObjCEncodingForBlock(), clang::ASTContext::getObjCEncodingForFunctionDecl(), clang::ASTContext::getObjCEncodingForMethodDecl(), clang::CodeGen::CodeGenFunction::InitializeVTablePointer(), clang::APValue::printPretty(), and clang::CodeGen::CodeGenModule::TryEmitBaseDestructorAsAlias().
static CharUnits clang::CharUnits::One | ( | ) | [inline, static] |
One - Construct a CharUnits quantity of one.
Definition at line 58 of file CharUnits.h.
References CharUnits().
Referenced by clang::APValue::printPretty().
Definition at line 95 of file CharUnits.h.
CharUnits clang::CharUnits::operator% | ( | QuantityType | N | ) | const [inline] |
Definition at line 143 of file CharUnits.h.
References CharUnits().
QuantityType clang::CharUnits::operator% | ( | const CharUnits & | Other | ) | const [inline] |
Definition at line 146 of file CharUnits.h.
CharUnits clang::CharUnits::operator* | ( | QuantityType | N | ) | const [inline] |
Definition at line 134 of file CharUnits.h.
References CharUnits().
Definition at line 149 of file CharUnits.h.
References CharUnits().
CharUnits& clang::CharUnits::operator++ | ( | ) | [inline] |
Definition at line 72 of file CharUnits.h.
CharUnits clang::CharUnits::operator++ | ( | int | ) | [inline] |
Definition at line 76 of file CharUnits.h.
References CharUnits().
Definition at line 68 of file CharUnits.h.
Definition at line 152 of file CharUnits.h.
References CharUnits().
CharUnits clang::CharUnits::operator- | ( | ) | const [inline] |
Definition at line 155 of file CharUnits.h.
References CharUnits().
CharUnits& clang::CharUnits::operator-- | ( | ) | [inline] |
Definition at line 83 of file CharUnits.h.
CharUnits clang::CharUnits::operator-- | ( | int | ) | [inline] |
Definition at line 87 of file CharUnits.h.
References CharUnits().
Definition at line 79 of file CharUnits.h.
CharUnits clang::CharUnits::operator/ | ( | QuantityType | N | ) | const [inline] |
Definition at line 137 of file CharUnits.h.
References CharUnits().
QuantityType clang::CharUnits::operator/ | ( | const CharUnits & | Other | ) | const [inline] |
Definition at line 140 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.
CharUnits clang::CharUnits::RoundUpToAlignment | ( | const CharUnits & | Align | ) | const [inline] |
RoundUpToAlignment - 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 168 of file CharUnits.h.
References CharUnits().
Referenced by computeBlockInfo().
static CharUnits clang::CharUnits::Zero | ( | ) | [inline, static] |
Zero - Construct a CharUnits quantity of zero.
Definition at line 53 of file CharUnits.h.
References CharUnits().
Referenced by BuildAppleKextVirtualCall(), CalculateCookiePadding(), computeBlockInfo(), computeFullPathsForVFTables(), ComputeNonVirtualBaseClassOffset(), createPlaceholderSlot(), DiagnoseReinterpretUpDownCast(), clang::CodeGen::CodeGenFunction::EmitAggregateAssign(), clang::CodeGen::CGCXXABI::GetArrayCookieSize(), clang::CodeGen::CGCXXABI::getArrayCookieSizeImpl(), clang::ento::ElementRegion::getAsArrayOffset(), clang::CodeGen::CGCXXABI::getMemberPointerPathAdjustment(), GetNumNonZeroBytesInInit(), clang::ASTContext::getObjCEncodingForFunctionDecl(), clang::ASTContext::getObjCEncodingTypeSize(), getTypeExpansion(), clang::ItaniumVTableContext::getVirtualBaseOffsetOffset(), clang::CodeGen::CodeGenFunction::InitializeVTablePointer(), clang::CodeGen::CodeGenFunction::InitializeVTablePointers(), clang::CodeGen::CGCXXABI::ReadArrayCookie(), and clang::VTTBuilder::VTTBuilder().