[PATCH] D78686: [PowerPC] Fix downcast from nullptr
Ng Zhi An via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 09:43:36 PDT 2020
ngzhian updated this revision to Diff 259600.
ngzhian added a comment.
Add null check
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78686/new/
https://reviews.llvm.org/D78686
Files:
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -1396,8 +1396,8 @@
bool isPPC64 = DL.getPointerSizeInBits() == 64;
- PPCTargetStreamer &TS =
- static_cast<PPCTargetStreamer &>(*OutStreamer->getTargetStreamer());
+ PPCTargetStreamer *TS =
+ static_cast<PPCTargetStreamer *>(OutStreamer->getTargetStreamer());
if (!TOC.empty()) {
const char *Name = isPPC64 ? ".toc" : ".got2";
@@ -1412,8 +1412,8 @@
MCSymbol *const TOCEntryLabel = TOCMapPair.second;
OutStreamer->emitLabel(TOCEntryLabel);
- if (isPPC64)
- TS.emitTCEntry(*TOCEntryTarget);
+ if (isPPC64 && TS != nullptr)
+ TS->emitTCEntry(*TOCEntryTarget);
else
OutStreamer->emitSymbolValue(TOCEntryTarget, 4);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78686.259600.patch
Type: text/x-patch
Size: 915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200423/dae0c67c/attachment.bin>
More information about the llvm-commits
mailing list