reset method for WinCOFFObjectWriter

Yaron Keren yaron.keren at gmail.com
Mon Sep 15 11:29:44 PDT 2014


This add a reset method for WinCOFFObjectWriter, like other MC* classes.

http://llvm.org/bugs/show_bug.cgi?id=20926
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140915/560e5bce/attachment.html>
-------------- next part --------------
Index: C:/llvm/lib/MC/WinCOFFObjectWriter.cpp
===================================================================
--- C:/llvm/lib/MC/WinCOFFObjectWriter.cpp	(revision 217432)
+++ C:/llvm/lib/MC/WinCOFFObjectWriter.cpp	(working copy)
@@ -114,6 +114,11 @@
   StringTable();
   size_t size() const;
   size_t insert(StringRef String);
+  void clear() {
+    Map.clear();
+    Data.resize(4);
+    update_length();
+  }
 };
 
 class WinCOFFObjectWriter : public MCObjectWriter {
@@ -139,6 +144,17 @@
 
   WinCOFFObjectWriter(MCWinCOFFObjectTargetWriter *MOTW, raw_ostream &OS);
 
+  void reset() override {
+    memset(&Header, 0, sizeof(Header));
+    Header.Machine = TargetObjectWriter->getMachine();
+    Sections.clear();
+    Symbols.clear();
+    Strings.clear();
+    SectionMap.clear();
+    SymbolMap.clear();
+    MCObjectWriter::reset();
+  }
+
   COFFSymbol *createSymbol(StringRef Name);
   COFFSymbol *GetOrCreateCOFFSymbol(const MCSymbol * Symbol);
   COFFSection *createSection(StringRef Name);


More information about the llvm-commits mailing list