add StructType helpers too.
authorChris Lattner <sabre@nondot.org>
Thu, 26 Jan 2012 00:06:44 +0000 (00:06 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 26 Jan 2012 00:06:44 +0000 (00:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149000 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Type.h
lib/VMCore/Type.cpp

index d3b2f1383fb4874a8f29734388332edcb639cf93..185258d8ff2afcd27d0b1d690d2d5f3fb4d7c6e0 100644 (file)
@@ -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;
   
index 627f6452c66bd81e5708997713767feaab1ee2f7..f5c88ccd38a3adb9b1fff67087df719b0210549a 100644 (file)
@@ -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();
 }