[llvm-commits] [llvm] r42272 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter.cpp

Dan Gohman djg at cray.com
Mon Sep 24 13:58:13 PDT 2007


Author: djg
Date: Mon Sep 24 15:58:13 2007
New Revision: 42272

URL: http://llvm.org/viewvc/llvm-project?rev=42272&view=rev
Log:
Add a routine for emitting .file directives, for setting up
file numbers to use with .loc directives.

Modified:
    llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
    llvm/trunk/lib/CodeGen/AsmPrinter.cpp

Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=42272&r1=42271&r2=42272&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Sep 24 15:58:13 2007
@@ -248,6 +248,9 @@
     /// @verbatim (Eg. '\t') @endverbatim
     void EmitString(const std::string &String) const;
     
+    /// EmitFile - Emit a .file directive.
+    void EmitFile(unsigned Number, const std::string &Name) const;
+
     //===------------------------------------------------------------------===//
 
     /// EmitAlignment - Emit an alignment directive to the specified power of

Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=42272&r1=42271&r2=42272&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Mon Sep 24 15:58:13 2007
@@ -618,6 +618,17 @@
 }
 
 
+/// EmitFile - Emit a .file directive.
+void AsmPrinter::EmitFile(unsigned Number, const std::string &Name) const {
+  O << "\t.file\t" << Number << " \"";
+  for (unsigned i = 0, N = Name.size(); i < N; ++i) {
+    unsigned char C = Name[i];
+    printStringChar(O, C);
+  }
+  O << "\"";
+}
+
+
 //===----------------------------------------------------------------------===//
 
 // EmitAlignment - Emit an alignment directive to the specified power of





More information about the llvm-commits mailing list