MC: remove duplicated code
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sat, 9 Aug 2014 17:21:36 +0000 (17:21 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Sat, 9 Aug 2014 17:21:36 +0000 (17:21 +0000)
This removes the duplicate definition of GetXDataSection.  This function is
available as a static method and is identical to the previous implementation.
This just cleans up the unnecessary duplication.

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

lib/MC/MCAsmStreamer.cpp

index 27cbd4962f12751b0b660e61c45d31d6d2352b52..dc6133e7fa1e61e919a5afb94fe5747c2ac77fc8 100644 (file)
@@ -1089,19 +1089,6 @@ void MCAsmStreamer::EmitWinEHHandler(const MCSymbol *Sym, bool Unwind,
   EmitEOL();
 }
 
-static const MCSection *getWin64EHTableSection(StringRef suffix,
-                                               MCContext &context) {
-  // FIXME: This doesn't belong in MCObjectFileInfo. However,
-  /// this duplicate code in MCWin64EH.cpp.
-  if (suffix == "")
-    return context.getObjectFileInfo()->getXDataSection();
-  return context.getCOFFSection((".xdata"+suffix).str(),
-                                COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
-                                COFF::IMAGE_SCN_MEM_READ |
-                                COFF::IMAGE_SCN_MEM_WRITE,
-                                SectionKind::getDataRel());
-}
-
 void MCAsmStreamer::EmitWinEHHandlerData() {
   MCStreamer::EmitWinEHHandlerData();
 
@@ -1111,7 +1098,8 @@ void MCAsmStreamer::EmitWinEHHandlerData() {
   // data block is visible.
   WinEH::FrameInfo *CurFrame = getCurrentWinFrameInfo();
   StringRef Suffix = WinEH::UnwindEmitter::GetSectionSuffix(CurFrame->Function);
-  if (const MCSection *XData = getWin64EHTableSection(Suffix, getContext()))
+  if (const MCSection *XData =
+          WinEH::UnwindEmitter::GetXDataSection(Suffix, getContext()))
     SwitchSectionNoChange(XData);
 
   OS << "\t.seh_handlerdata";