aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Type.h5
-rw-r--r--lib/VMCore/Type.cpp14
2 files changed, 18 insertions, 1 deletions
diff --git a/include/llvm/Type.h b/include/llvm/Type.h
index d3b2f13..185258d 100644
--- a/include/llvm/Type.h
+++ b/include/llvm/Type.h
@@ -26,6 +26,7 @@ class raw_ostream;
class Module;
class LLVMContext;
class LLVMContextImpl;
+class StringRef;
template<class GraphType> struct GraphTraits;
/// The instances of the Type class are immutable: once they are created,
@@ -327,7 +328,9 @@ public:
unsigned getFunctionNumParams() const;
bool isFunctionVarArg() const;
- // TODO: StructType
+ StringRef getStructName() const;
+ unsigned getStructNumElements() const;
+ Type *getStructElementType(unsigned N) const;
Type *getSequentialElementType() const;
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index 627f645..f5c88cc 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -217,6 +217,20 @@ unsigned Type::getFunctionNumParams() const {
return cast<FunctionType>(this)->getNumParams();
}
+StringRef Type::getStructName() const {
+ return cast<StructType>(this)->getName();
+}
+
+unsigned Type::getStructNumElements() const {
+ return cast<StructType>(this)->getNumElements();
+}
+
+Type *Type::getStructElementType(unsigned N) const {
+ return cast<StructType>(this)->getElementType(N);
+}
+
+
+
Type *Type::getSequentialElementType() const {
return cast<SequentialType>(this)->getElementType();
}