wirte up .file and .file to the mc asmparser.
authorChris Lattner <sabre@nondot.org>
Mon, 25 Jan 2010 19:02:58 +0000 (19:02 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 25 Jan 2010 19:02:58 +0000 (19:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94438 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCParser/AsmParser.cpp
test/MC/AsmParser/directive_file.s

index 077d2dffa65ab2ee697c456aa5cc486579fd4ac3..d5bc396103fe4b32da158c8461ff31a767cd46a0 100644 (file)
@@ -1708,14 +1708,18 @@ bool AsmParser::ParseDirectiveFile(StringRef, SMLoc DirectiveLoc) {
   if (Lexer.isNot(AsmToken::String))
     return TokError("unexpected token in '.file' directive");
   
-  StringRef ATTRIBUTE_UNUSED FileName = getTok().getString();
+  StringRef Filename = getTok().getString();
+  Filename = Filename.substr(1, Filename.size()-2);
   Lex();
 
   if (Lexer.isNot(AsmToken::EndOfStatement))
     return TokError("unexpected token in '.file' directive");
 
-  // FIXME: Do something with the .file.
-
+  if (FileNumber == -1)
+    Out.EmitFileDirective(Filename);
+  else
+    Out.EmitDwarfFileDirective(FileNumber, Filename);
+  
   return false;
 }
 
index ec0b9543b9423da3ad635497c0676842400c96d7..3160d5c2bfd7286cd11faad5ef06f0c78b25d198 100644 (file)
@@ -1,5 +1,8 @@
-# RUN: llvm-mc -triple i386-unknown-unknown %s
-# FIXME: Actually test the output.
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
 
         .file "hello"
         .file 1 "world"
+
+# CHECK: .file "hello"
+# CHECK: .file 1 "world"
+