This patch changes a static_cast to dyn_cast

for MipsELFStreamer objects.

Contributer: Jack Carter
 
llvm-svn: 174354
This commit is contained in:
Jack Carter 2013-02-05 07:47:41 +00:00
parent 0120178909
commit 10be6aef15
3 changed files with 8 additions and 3 deletions

View File

@ -57,6 +57,7 @@ namespace llvm {
SK_ARMELFStreamer,
SK_MachOStreamer,
SK_PureStreamer,
SK_MipsELFStreamer,
SK_WinCOFFStreamer
};

View File

@ -19,12 +19,16 @@ public:
MipsELFStreamer(MCContext &Context, MCAsmBackend &TAB,
raw_ostream &OS, MCCodeEmitter *Emitter,
bool RelaxAll, bool NoExecStack)
: MCELFStreamer(Context, TAB, OS, Emitter) {
: MCELFStreamer(SK_MipsELFStreamer, Context, TAB, OS, Emitter) {
}
~MipsELFStreamer() {}
void emitELFHeaderFlagsCG(const MipsSubtarget &Subtarget);
// void emitELFHeaderFlagCG(unsigned Val);
static bool classof(const MCStreamer *S) {
return S->getKind() == SK_MipsELFStreamer;
}
};
MCELFStreamer* createMipsELFStreamer(MCContext &Context, MCAsmBackend &TAB,

View File

@ -551,8 +551,8 @@ void MipsAsmPrinter::EmitEndOfAsmFile(Module &M) {
// Emit Mips ELF register info
Subtarget->getMReginfo().emitMipsReginfoSectionCG(
OutStreamer, getObjFileLowering(), *Subtarget);
MipsELFStreamer & MES = static_cast<MipsELFStreamer &>(OutStreamer);
MES.emitELFHeaderFlagsCG(*Subtarget);
if (MipsELFStreamer *MES = dyn_cast<MipsELFStreamer>(&OutStreamer))
MES->emitELFHeaderFlagsCG(*Subtarget);
}
MachineLocation