MCNullStreamer: assign file IDs to resolve crashes and errors
authorAlp Toker <alp@nuanti.com>
Thu, 19 Jun 2014 17:15:36 +0000 (17:15 +0000)
committerAlp Toker <alp@nuanti.com>
Thu, 19 Jun 2014 17:15:36 +0000 (17:15 +0000)
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

lib/MC/MCNullStreamer.cpp
test/DebugInfo/global.ll
test/MC/AsmParser/directive_file.s
test/MC/AsmParser/directive_line.s
test/MC/AsmParser/directive_loc.s

index 4f2740ed3ae9ffbc2fed55aee38136943fa8514c..5ab2829a6ba367d9bd213ed413dda0fc500ff456 100644 (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 {}
index c515114fd50bb58f5c66b57a953de0c6dfbd75e0..3c97f0cb227951dd42bc6905050b676d362f08f5 100644 (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() {
index 9b99e0f24e998407ffb991416b2f691b78441513..d7290ebe1dbeb45f81e90797f60890b7108ff798 100644 (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"
index 94ce44602998e72dab5d5e862b382264874e5e04..110b68a46216cf90caea38e929d2753f0fe906ea 100644 (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
index cda9579fb2725e09a25be524fc7f368ddc819c17..404ebcecdd0a476b64c92114fc973c8901277e04 100644 (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"