Fix MSVC warning.
[oota-llvm.git] / lib / MC / MCObjectStreamer.cpp
index 119df0a083dc3fdbc05cfb7257cd0648635e86b8..35786accb429bcdd36fd0b8a903de88b373dd938 100644 (file)
@@ -20,6 +20,7 @@
 #include "llvm/MC/MCSection.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/MC/MCSectionELF.h"
 using namespace llvm;
 
 MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
@@ -63,7 +64,11 @@ MCDataFragment *MCObjectStreamer::getOrCreateDataFragment() const {
   // When bundling is enabled, we don't want to add data to a fragment that
   // already has instructions (see MCELFStreamer::EmitInstToData for details)
   if (!F || (Assembler->isBundlingEnabled() && F->hasInstructions())) {
-    F = new MCDataFragment();
+    const auto *Sec = dyn_cast<MCSectionELF>(&getCurrentSectionData()->getSection());
+    if (Sec && Sec->getSectionName().startswith(".zdebug_"))
+      F = new MCCompressedFragment();
+    else
+      F = new MCDataFragment();
     insert(F);
   }
   return F;
@@ -184,7 +189,8 @@ void MCObjectStreamer::ChangeSection(const MCSection *Section,
 
 void MCObjectStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
   getAssembler().getOrCreateSymbolData(*Symbol);
-  Symbol->setVariableValue(AddValueSymbols(Value));
+  AddValueSymbols(Value);
+  MCStreamer::EmitAssignment(Symbol, Value);
 }
 
 void MCObjectStreamer::EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) {
@@ -379,9 +385,8 @@ void MCObjectStreamer::EmitZeros(uint64_t NumBytes) {
 void MCObjectStreamer::FinishImpl() {
   // Dump out the dwarf file & directory tables and line tables.
   const MCSymbol *LineSectionSymbol = NULL;
-  if (!getContext().getMCLineTableSymbols().empty() ||
-      getContext().hasDwarfFiles())
-    LineSectionSymbol = MCDwarfFileTable::Emit(this);
+  if (getContext().hasMCLineSections())
+    LineSectionSymbol = MCDwarfLineTable::Emit(this);
 
   // If we are generating dwarf for assembly source files dump out the sections.
   if (getContext().getGenDwarfForAssembly())