[llvm] r215289 - MC: remove duplicated code

Saleem Abdulrasool compnerd at compnerd.org
Sat Aug 9 10:21:36 PDT 2014


Author: compnerd
Date: Sat Aug  9 12:21:36 2014
New Revision: 215289

URL: http://llvm.org/viewvc/llvm-project?rev=215289&view=rev
Log:
MC: remove duplicated code

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.

Modified:
    llvm/trunk/lib/MC/MCAsmStreamer.cpp

Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=215289&r1=215288&r2=215289&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Sat Aug  9 12:21:36 2014
@@ -1089,19 +1089,6 @@ void MCAsmStreamer::EmitWinEHHandler(con
   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";





More information about the llvm-commits mailing list