AsmPrinter.cpp: Avoid crashes for targeting like "arm-mingw32". CurrentFnSym might not be <MCSymbolELF> here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239692 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
NAKAMURA Takumi 2015-06-14 00:23:40 +00:00
parent 82b72bed60
commit 145cdc632a

View File

@ -902,7 +902,8 @@ void AsmPrinter::EmitFunctionBody() {
const MCExpr *SizeExp = MCBinaryExpr::createSub(
MCSymbolRefExpr::create(CurrentFnEnd, OutContext),
MCSymbolRefExpr::create(CurrentFnSymForSize, OutContext), OutContext);
OutStreamer->emitELFSize(cast<MCSymbolELF>(CurrentFnSym), SizeExp);
if (auto Sym = dyn_cast<MCSymbolELF>(CurrentFnSym))
OutStreamer->emitELFSize(Sym, SizeExp);
}
for (const HandlerInfo &HI : Handlers) {