Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 36a3211

Browse files
committed
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211282 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent e4d0a5e commit 36a3211

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

lib/MC/MCNullStreamer.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,7 @@ namespace {
8181
unsigned char Value = 0) override { return false; }
8282

8383
void EmitFileDirective(StringRef Filename) override {}
84-
unsigned EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
85-
StringRef Filename,
86-
unsigned CUID = 0) override {
87-
return 0;
88-
}
89-
void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
90-
unsigned Column, unsigned Flags,
91-
unsigned Isa, unsigned Discriminator,
92-
StringRef FileName) override {}
84+
9385
void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo&) override {}
9486

9587
void EmitBundleAlignMode(unsigned AlignPow2) override {}

test/DebugInfo/global.ll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t
44
; RUN: llvm-dwarfdump %t | FileCheck %s
55

6+
; Also test that the null streamer doesn't crash with debug info.
7+
; RUN: %llc_dwarf -O0 -filetype=null < %s
8+
69
; generated from the following source compiled to bitcode with clang -g -O1
710
; static int i;
811
; int main() {

test/MC/AsmParser/directive_file.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
2+
# RUN: llvm-mc -triple i386-unknown-unknown %s -filetype=null
23

34
.file "hello"
45
.file 1 "worl\144" # "\144" is "d"

test/MC/AsmParser/directive_line.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# RUN: llvm-mc -triple i386-unknown-unknown %s
2+
# RUN: llvm-mc -triple i386-unknown-unknown %s -filetype=null
23
# FIXME: Actually test the output.
34

45
.line

test/MC/AsmParser/directive_loc.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
2+
# RUN: llvm-mc -triple i386-unknown-unknown %s -filetype=null
23

34
.file 1 "hello"
45
# CHECK: .file 1 "hello"

0 commit comments

Comments
 (0)