MCNullStreamer.cpp revision 204961
16527Sache//===- lib/MC/MCNullStreamer.cpp - Dummy Streamer Implementation ----------===// 26527Sache// 36527Sache// The LLVM Compiler Infrastructure 46527Sache// 56527Sache// This file is distributed under the University of Illinois Open Source 66527Sache// License. See LICENSE.TXT for details. 76527Sache// 86527Sache//===----------------------------------------------------------------------===// 96527Sache 106527Sache#include "llvm/MC/MCStreamer.h" 116527Sache 126527Sache#include "llvm/MC/MCContext.h" 136527Sache#include "llvm/MC/MCInst.h" 146527Sache#include "llvm/MC/MCSectionMachO.h" 156527Sache#include "llvm/MC/MCSymbol.h" 166527Sache 176527Sacheusing namespace llvm; 186527Sache 196527Sachenamespace { 206527Sache 216527Sache class MCNullStreamer : public MCStreamer { 226527Sache public: 236527Sache MCNullStreamer(MCContext &Context) : MCStreamer(Context) {} 246527Sache 256527Sache /// @name MCStreamer Interface 266527Sache /// @{ 276527Sache 286527Sache virtual void SwitchSection(const MCSection *Section) { 2916073Sphk CurSection = Section; 306527Sache } 316527Sache 326527Sache virtual void EmitLabel(MCSymbol *Symbol) { 336527Sache assert(Symbol->isUndefined() && "Cannot define a symbol twice!"); 346527Sache assert(CurSection && "Cannot emit before setting section!"); 356527Sache Symbol->setSection(*CurSection); 366527Sache } 3716073Sphk 386527Sache virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) {} 396527Sache 406527Sache virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {} 416527Sache 426527Sache virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute){} 436527Sache 446527Sache virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {} 456527Sache virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {} 466527Sache virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, 476527Sache unsigned ByteAlignment) {} 486527Sache virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) {} 496527Sache 506527Sache virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0, 516527Sache unsigned Size = 0, unsigned ByteAlignment = 0) {} 526527Sache 536527Sache virtual void EmitBytes(StringRef Data, unsigned AddrSpace) {} 546527Sache 556527Sache virtual void EmitValue(const MCExpr *Value, unsigned Size, 566527Sache unsigned AddrSpace) {} 576527Sache virtual void EmitGPRel32Value(const MCExpr *Value) {} 586527Sache virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0, 596527Sache unsigned ValueSize = 1, 606527Sache unsigned MaxBytesToEmit = 0) {} 616527Sache 626527Sache virtual void EmitCodeAlignment(unsigned ByteAlignment, 636527Sache unsigned MaxBytesToEmit = 0) {} 646527Sache 656527Sache virtual void EmitValueToOffset(const MCExpr *Offset, 666527Sache unsigned char Value = 0) {} 676527Sache 686527Sache virtual void EmitFileDirective(StringRef Filename) {} 696527Sache virtual void EmitDwarfFileDirective(unsigned FileNo,StringRef Filename) {} 706527Sache virtual void EmitInstruction(const MCInst &Inst) {} 716527Sache 726527Sache virtual void Finish() {} 736527Sache 746527Sache /// @} 756527Sache }; 766527Sache 776527Sache} 786527Sache 796527SacheMCStreamer *llvm::createNullStreamer(MCContext &Context) { 806527Sache return new MCNullStreamer(Context); 816527Sache} 826527Sache