[llvm] r211282 - MCNullStreamer: assign file IDs to resolve crashes and errors

Alp Toker alp at nuanti.com
Thu Jun 19 10:15:36 PDT 2014


Author: alp
Date: Thu Jun 19 12:15:36 2014
New Revision: 211282

URL: http://llvm.org/viewvc/llvm-project?rev=211282&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/MC/MCNullStreamer.cpp
    llvm/trunk/test/DebugInfo/global.ll
    llvm/trunk/test/MC/AsmParser/directive_file.s
    llvm/trunk/test/MC/AsmParser/directive_line.s
    llvm/trunk/test/MC/AsmParser/directive_loc.s

Modified: llvm/trunk/lib/MC/MCNullStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=211282&r1=211281&r2=211282&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCNullStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCNullStreamer.cpp Thu Jun 19 12:15:36 2014
@@ -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 {}

Modified: llvm/trunk/test/DebugInfo/global.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/global.ll?rev=211282&r1=211281&r2=211282&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/global.ll (original)
+++ llvm/trunk/test/DebugInfo/global.ll Thu Jun 19 12:15:36 2014
@@ -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() {

Modified: llvm/trunk/test/MC/AsmParser/directive_file.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_file.s?rev=211282&r1=211281&r2=211282&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_file.s (original)
+++ llvm/trunk/test/MC/AsmParser/directive_file.s Thu Jun 19 12:15:36 2014
@@ -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"

Modified: llvm/trunk/test/MC/AsmParser/directive_line.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_line.s?rev=211282&r1=211281&r2=211282&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_line.s (original)
+++ llvm/trunk/test/MC/AsmParser/directive_line.s Thu Jun 19 12:15:36 2014
@@ -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

Modified: llvm/trunk/test/MC/AsmParser/directive_loc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_loc.s?rev=211282&r1=211281&r2=211282&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_loc.s (original)
+++ llvm/trunk/test/MC/AsmParser/directive_loc.s Thu Jun 19 12:15:36 2014
@@ -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"





More information about the llvm-commits mailing list