Make getContainedType more efficient by not returning null if out of range!
[oota-llvm.git] / include / llvm / DerivedTypes.h
index 57a8c02e4d8d6c178148954da4df5137f3dbec00..e0ccffd5fb7e9371e01d48b437a86e5a0b3bab8b 100644 (file)
@@ -156,8 +156,7 @@ public:
 
 
   virtual const Type *getContainedType(unsigned i) const {
-    return i == 0 ? ResultType : 
-                    (i <= ParamTys.size() ? ParamTys[i-1].get() : 0);
+    return i == 0 ? ResultType.get() : ParamTys[i-1].get();
   }
   virtual unsigned getNumContainedTypes() const { return ParamTys.size()+1; }
 
@@ -239,7 +238,7 @@ public:
   inline const ElementTypes &getElementTypes() const { return ETypes; }
 
   virtual const Type *getContainedType(unsigned i) const { 
-    return i < ETypes.size() ? ETypes[i].get() : 0;
+    return ETypes[i].get();
   }
   virtual unsigned getNumContainedTypes() const { return ETypes.size(); }
 
@@ -289,7 +288,7 @@ public:
   inline const Type *getElementType() const { return ElementType; }
 
   virtual const Type *getContainedType(unsigned i) const { 
-    return i == 0 ? ElementType.get() : 0;
+    return ElementType.get();
   }
   virtual unsigned getNumContainedTypes() const { return 1; }