diff options
Diffstat (limited to 'lib/VMCore/Type.cpp')
-rw-r--r-- | lib/VMCore/Type.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 7edd9e63f5..627f6452c6 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -198,6 +198,45 @@ bool Type::isSizedDerivedType() const { } //===----------------------------------------------------------------------===// +// Subclass Helper Methods +//===----------------------------------------------------------------------===// + +unsigned Type::getIntegerBitWidth() const { + return cast<IntegerType>(this)->getBitWidth(); +} + +bool Type::isFunctionVarArg() const { + return cast<FunctionType>(this)->isVarArg(); +} + +Type *Type::getFunctionParamType(unsigned i) const { + return cast<FunctionType>(this)->getParamType(i); +} + +unsigned Type::getFunctionNumParams() const { + return cast<FunctionType>(this)->getNumParams(); +} + +Type *Type::getSequentialElementType() const { + return cast<SequentialType>(this)->getElementType(); +} + +uint64_t Type::getArrayNumElements() const { + return cast<ArrayType>(this)->getNumElements(); +} + +unsigned Type::getVectorNumElements() const { + return cast<VectorType>(this)->getNumElements(); +} + +unsigned Type::getPointerAddressSpace() const { + return cast<PointerType>(this)->getAddressSpace(); +} + + + + +//===----------------------------------------------------------------------===// // Primitive 'Type' data //===----------------------------------------------------------------------===// |