Address a memory leak in 254760
[oota-llvm.git] / include / llvm / IR / LegacyPassManagers.h
index af045585691b868e29a0fa2b4e559789e7c00828..418702c0b781ae1a481e783c1424f42e7138697c 100644 (file)
@@ -264,12 +264,15 @@ private:
       // TODO: We could consider sorting the dependency arrays within the
       // AnalysisUsage (since they are conceptually unordered).
       ID.AddBoolean(AU.getPreservesAll());
-      for (auto &Vec : {AU.getRequiredSet(), AU.getRequiredTransitiveSet(),
-            AU.getPreservedSet(), AU.getUsedSet()}) {
+      auto ProfileVec = [&](const SmallVectorImpl<AnalysisID>& Vec) {
         ID.AddInteger(Vec.size());
         for(AnalysisID AID : Vec)
           ID.AddPointer(AID);
-      }
+      };
+      ProfileVec(AU.getRequiredSet());
+      ProfileVec(AU.getRequiredTransitiveSet());
+      ProfileVec(AU.getPreservedSet());
+      ProfileVec(AU.getUsedSet());
     }
   };