IR: cleanup Module::dropReferences
authorDavid Majnemer <david.majnemer@gmail.com>
Thu, 3 Jul 2014 16:12:55 +0000 (16:12 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Thu, 3 Jul 2014 16:12:55 +0000 (16:12 +0000)
This replaces some old-style loops with range-based for.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212278 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/Module.cpp

index d853bf4cfa2cb68b3510a59b871f7934adc0f2bd..f1b1f9a2acc877f094343c5c0bfbbe1919891346 100644 (file)
@@ -437,14 +437,14 @@ std::error_code Module::materializeAllPermanently(bool ReleaseBuffer) {
 // has "dropped all references", except operator delete.
 //
 void Module::dropAllReferences() {
-  for(Module::iterator I = begin(), E = end(); I != E; ++I)
-    I->dropAllReferences();
+  for (Function &F : *this)
+    F.dropAllReferences();
 
-  for(Module::global_iterator I = global_begin(), E = global_end(); I != E; ++I)
-    I->dropAllReferences();
+  for (GlobalVariable &GV : globals())
+    GV.dropAllReferences();
 
-  for(Module::alias_iterator I = alias_begin(), E = alias_end(); I != E; ++I)
-    I->dropAllReferences();
+  for (GlobalAlias &GA : aliases())
+    GA.dropAllReferences();
 }
 
 unsigned Module::getDwarfVersion() const {