Constants KNOW they are of a derived type
authorChris Lattner <sabre@nondot.org>
Thu, 13 Dec 2001 00:38:57 +0000 (00:38 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 13 Dec 2001 00:38:57 +0000 (00:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1439 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Constants.h

index 08fc8b369b78ce744ce731c22f0c0880f6b0b9e4..7ce2feced7bd70d3a6d73be52e682d57d4f11d53 100644 (file)
@@ -232,6 +232,9 @@ public:
   static ConstantArray *get(const string &Initializer);
   
   virtual string getStrValue() const;
+  inline const ArrayType *getType() const {
+    return (ArrayType*)Value::getType();
+  }
 
   inline const vector<Use> &getValues() const { return Operands; }
 
@@ -263,6 +266,9 @@ public:
                              const vector<Constant*> &V);
 
   virtual string getStrValue() const;
+  inline const StructType *getType() const {
+    return (StructType*)Value::getType();
+  }
 
   inline const vector<Use> &getValues() const { return Operands; }
 
@@ -292,6 +298,9 @@ protected:
   ~ConstantPointer() {}
 public:
   virtual string getStrValue() const = 0;
+  inline const PointerType *getType() const {
+    return (PointerType*)Value::getType();
+  }
 
   // isNullValue - Return true if this is the value that would be returned by
   // getNullConstant.