Add and use Type::subtypes. NFC.
[oota-llvm.git] / lib / Bitcode / Writer / ValueEnumerator.cpp
index f065c83ab892471ae752fb6774be29b91ae2769e..6971d3aacd31afaa2bd61de9e3a3e1eea27b2dc5 100644 (file)
@@ -620,9 +620,8 @@ void ValueEnumerator::EnumerateType(Type *Ty) {
 
   // Enumerate all of the subtypes before we enumerate this type.  This ensures
   // that the type will be enumerated in an order that can be directly built.
 
   // Enumerate all of the subtypes before we enumerate this type.  This ensures
   // that the type will be enumerated in an order that can be directly built.
-  for (Type::subtype_iterator I = Ty->subtype_begin(), E = Ty->subtype_end();
-       I != E; ++I)
-    EnumerateType(*I);
+  for (Type *SubTy : Ty->subtypes())
+    EnumerateType(SubTy);
 
   // Refresh the TypeID pointer in case the table rehashed.
   TypeID = &TypeMap[Ty];
 
   // Refresh the TypeID pointer in case the table rehashed.
   TypeID = &TypeMap[Ty];