[llvm] r217907 - This add a reset method for WinCOFFObjectWriter, like other MC* classes.

Yaron Keren yaron.keren at gmail.com
Tue Sep 16 14:31:04 PDT 2014


Author: yrnkrn
Date: Tue Sep 16 16:31:04 2014
New Revision: 217907

URL: http://llvm.org/viewvc/llvm-project?rev=217907&view=rev
Log:
This add a reset method for WinCOFFObjectWriter, like other MC* classes.


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

Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=217907&r1=217906&r2=217907&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Tue Sep 16 16:31:04 2014
@@ -113,6 +113,11 @@ public:
   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 @@ public:
   bool UseBigObj;
 
   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);





More information about the llvm-commits mailing list