clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions
clang::CharUnits Class Reference

#include <CharUnits.h>

List of all members.

Public Types

typedef int64_t QuantityType

Public Member Functions

 CharUnits ()
 CharUnits - A default constructor.
CharUnitsoperator+= (const CharUnits &Other)
CharUnitsoperator++ ()
CharUnits operator++ (int)
CharUnitsoperator-= (const CharUnits &Other)
CharUnitsoperator-- ()
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.

Detailed Description

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.


Member Typedef Documentation

Definition at line 40 of file CharUnits.h.


Constructor & Destructor Documentation

clang::CharUnits::CharUnits ( ) [inline]

Member Function Documentation

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]

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]

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]
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().

bool clang::CharUnits::operator!= ( const CharUnits Other) const [inline]

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

CharUnits clang::CharUnits::operator+ ( const CharUnits Other) const [inline]

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

CharUnits& clang::CharUnits::operator+= ( const CharUnits Other) [inline]

Definition at line 68 of file CharUnits.h.

CharUnits clang::CharUnits::operator- ( const CharUnits Other) const [inline]

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

CharUnits& clang::CharUnits::operator-= ( const CharUnits Other) [inline]

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.

bool clang::CharUnits::operator< ( const CharUnits Other) const [inline]

Definition at line 100 of file CharUnits.h.

bool clang::CharUnits::operator<= ( const CharUnits Other) const [inline]

Definition at line 103 of file CharUnits.h.

bool clang::CharUnits::operator== ( const CharUnits Other) const [inline]

Definition at line 92 of file CharUnits.h.

bool clang::CharUnits::operator> ( const CharUnits Other) const [inline]

Definition at line 106 of file CharUnits.h.

bool clang::CharUnits::operator>= ( const CharUnits Other) const [inline]

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]

The documentation for this class was generated from the following file: