Add a routine for emitting .file directives, for setting up
authorDan Gohman <gohman@apple.com>
Mon, 24 Sep 2007 20:58:13 +0000 (20:58 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 24 Sep 2007 20:58:13 +0000 (20:58 +0000)
file numbers to use with .loc directives.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42272 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/AsmPrinter.h
lib/CodeGen/AsmPrinter.cpp

index 4a312a79a282271ca08cab775a59c60724956ebc..0ca7cfcbb8ce11e092128011cb4a4b12b901ade6 100644 (file)
@@ -248,6 +248,9 @@ namespace llvm {
     /// @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
index 6622bcdee669e8ef605777b770713ce7b32e6633..521386b19fae859924f081e6e3a0f97c2243243a 100644 (file)
@@ -618,6 +618,17 @@ void AsmPrinter::EmitString(const std::string &String) const {
 }
 
 
+/// 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