summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2015-06-14 00:23:40 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2015-06-14 00:23:40 +0000
commita6a250a21145e852fafd5ab316732134ca08eb2c (patch)
treed9fc8acfe6977f6d0ffd5ebf6c20a88342631328 /llvm/lib
parentbf6ad02906aab926f82a97c684845d84897267bc (diff)
downloadbcm5719-llvm-a6a250a21145e852fafd5ab316732134ca08eb2c.tar.gz
bcm5719-llvm-a6a250a21145e852fafd5ab316732134ca08eb2c.zip
AsmPrinter.cpp: Avoid crashes for targeting like "arm-mingw32". CurrentFnSym might not be <MCSymbolELF> here.
llvm-svn: 239692
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index cb8aa72e246..85ee9b3b853 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -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) {
OpenPOWER on IntegriCloud