[PATCH] D54008: [X86] Fix MCNullStreamer support for modules with a CodeView flag
Eugene Sharygin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 1 15:15:59 PDT 2018
eush created this revision.
eush added reviewers: craig.topper, RKSimon.
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.
Repository:
rL LLVM
https://reviews.llvm.org/D54008
Files:
lib/Target/X86/X86AsmPrinter.cpp
test/CodeGen/X86/null-streamer.ll
Index: test/CodeGen/X86/null-streamer.ll
===================================================================
--- test/CodeGen/X86/null-streamer.ll
+++ test/CodeGen/X86/null-streamer.ll
@@ -14,7 +14,7 @@
}
!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 @@
!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}
Index: lib/Target/X86/X86AsmPrinter.cpp
===================================================================
--- lib/Target/X86/X86AsmPrinter.cpp
+++ lib/Target/X86/X86AsmPrinter.cpp
@@ -92,15 +92,17 @@
static_cast<X86TargetStreamer *>(OutStreamer->getTargetStreamer());
unsigned ParamsSize =
MF->getInfo<X86MachineFunctionInfo>()->getArgumentStackSize();
- XTS->emitFPOProc(CurrentFnSym, ParamsSize);
+
+ if (XTS)
+ XTS->emitFPOProc(CurrentFnSym, ParamsSize);
}
}
void X86AsmPrinter::EmitFunctionBodyEnd() {
if (EmitFPOData) {
- X86TargetStreamer *XTS =
- static_cast<X86TargetStreamer *>(OutStreamer->getTargetStreamer());
- XTS->emitFPOEndProc();
+ if (X86TargetStreamer *XTS =
+ static_cast<X86TargetStreamer *>(OutStreamer->getTargetStreamer()))
+ XTS->emitFPOEndProc();
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54008.172250.patch
Type: text/x-patch
Size: 1620 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181101/f4e09544/attachment.bin>
More information about the llvm-commits
mailing list