MCNullStreamer: assign file IDs to resolve crashes and errors

Use the MCStreamer base implementations for file ID tracking instead of
overriding them as no-ops.

Avoids assertions when streaming Dwarf debug info, and fixes ASM parsing of loc
and file directives.

llvm-svn: 211282
This commit is contained in:
Alp Toker 2014-06-19 17:15:36 +00:00
parent 37fcb5919d
commit 660839f210
5 changed files with 7 additions and 9 deletions

View File

@ -81,15 +81,7 @@ namespace {
unsigned char Value = 0) override { return false; }
void EmitFileDirective(StringRef Filename) override {}
unsigned EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
StringRef Filename,
unsigned CUID = 0) override {
return 0;
}
void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
unsigned Column, unsigned Flags,
unsigned Isa, unsigned Discriminator,
StringRef FileName) override {}
void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo&) override {}
void EmitBundleAlignMode(unsigned AlignPow2) override {}

View File

@ -3,6 +3,9 @@
; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t
; RUN: llvm-dwarfdump %t | FileCheck %s
; Also test that the null streamer doesn't crash with debug info.
; RUN: %llc_dwarf -O0 -filetype=null < %s
; generated from the following source compiled to bitcode with clang -g -O1
; static int i;
; int main() {

View File

@ -1,4 +1,5 @@
# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
# RUN: llvm-mc -triple i386-unknown-unknown %s -filetype=null
.file "hello"
.file 1 "worl\144" # "\144" is "d"

View File

@ -1,4 +1,5 @@
# RUN: llvm-mc -triple i386-unknown-unknown %s
# RUN: llvm-mc -triple i386-unknown-unknown %s -filetype=null
# FIXME: Actually test the output.
.line

View File

@ -1,4 +1,5 @@
# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
# RUN: llvm-mc -triple i386-unknown-unknown %s -filetype=null
.file 1 "hello"
# CHECK: .file 1 "hello"