[MC] Use unique_ptr to manage WinFrameInfos, NFC

The FrameInfo cannot be stored directly in the vector because chained
frames may refer to parent frames, so we need pointers that are stable
across a vector resize.

llvm-svn: 315080
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index 61f65c5..7521a75 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -56,17 +56,12 @@
   SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
 }
 
-MCStreamer::~MCStreamer() {
-  for (unsigned i = 0; i < getNumWinFrameInfos(); ++i)
-    delete WinFrameInfos[i];
-}
+MCStreamer::~MCStreamer() {}
 
 void MCStreamer::reset() {
   DwarfFrameInfos.clear();
-  for (unsigned i = 0; i < getNumWinFrameInfos(); ++i)
-    delete WinFrameInfos[i];
-  WinFrameInfos.clear();
   CurrentWinFrameInfo = nullptr;
+  WinFrameInfos.clear();
   SymbolOrdering.clear();
   SectionStack.clear();
   SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
@@ -538,8 +533,9 @@
 
   MCSymbol *StartProc = EmitCFILabel();
 
-  WinFrameInfos.push_back(new WinEH::FrameInfo(Symbol, StartProc));
-  CurrentWinFrameInfo = WinFrameInfos.back();
+  WinFrameInfos.emplace_back(
+      llvm::make_unique<WinEH::FrameInfo>(Symbol, StartProc));
+  CurrentWinFrameInfo = WinFrameInfos.back().get();
   CurrentWinFrameInfo->TextSection = getCurrentSectionOnly();
 }
 
@@ -557,9 +553,9 @@
 
   MCSymbol *StartProc = EmitCFILabel();
 
-  WinFrameInfos.push_back(new WinEH::FrameInfo(CurrentWinFrameInfo->Function,
-                                               StartProc, CurrentWinFrameInfo));
-  CurrentWinFrameInfo = WinFrameInfos.back();
+  WinFrameInfos.emplace_back(llvm::make_unique<WinEH::FrameInfo>(
+      CurrentWinFrameInfo->Function, StartProc, CurrentWinFrameInfo));
+  CurrentWinFrameInfo = WinFrameInfos.back().get();
   CurrentWinFrameInfo->TextSection = getCurrentSectionOnly();
 }