[X86] Fix MCNullStreamer support for modules with a CodeView flag

This fixes -filetype=null support when compiling for a Win32 target and the module has a CodeView flag.

The only places changed are the uses of getTargetStreamer function - this patch guards both of them with null checks.

Committed on behalf of @eush (Eugene Sharygin)

Differential Revision: https://reviews.llvm.org/D54008

llvm-svn: 346962
This commit is contained in:
Simon Pilgrim 2018-11-15 15:17:15 +00:00
parent 35f3da1925
commit 0db8cb0147
2 changed files with 10 additions and 10 deletions

View File

@ -88,19 +88,19 @@ bool X86AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
void X86AsmPrinter::EmitFunctionBodyStart() {
if (EmitFPOData) {
X86TargetStreamer *XTS =
static_cast<X86TargetStreamer *>(OutStreamer->getTargetStreamer());
unsigned ParamsSize =
MF->getInfo<X86MachineFunctionInfo>()->getArgumentStackSize();
XTS->emitFPOProc(CurrentFnSym, ParamsSize);
if (auto *XTS =
static_cast<X86TargetStreamer *>(OutStreamer->getTargetStreamer()))
XTS->emitFPOProc(
CurrentFnSym,
MF->getInfo<X86MachineFunctionInfo>()->getArgumentStackSize());
}
}
void X86AsmPrinter::EmitFunctionBodyEnd() {
if (EmitFPOData) {
X86TargetStreamer *XTS =
static_cast<X86TargetStreamer *>(OutStreamer->getTargetStreamer());
XTS->emitFPOEndProc();
if (auto *XTS =
static_cast<X86TargetStreamer *>(OutStreamer->getTargetStreamer()))
XTS->emitFPOEndProc();
}
}

View File

@ -14,7 +14,7 @@ define void @f1() {
}
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!7, !8}
!llvm.module.flags = !{!7, !8, !9}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: " ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !3, imports: !2)
!1 = !DIFile(filename: "file.c", directory: "")
@ -25,4 +25,4 @@ define void @f1() {
!6 = !DIBasicType(size: 32, align: 32, encoding: DW_ATE_signed)
!7 = !{i32 2, !"Dwarf Version", i32 3}
!8 = !{i32 1, !"Debug Info Version", i32 3}
!9 = !{i32 2, !"CodeView", i32 1}