aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2007-09-24 20:58:13 +0000
committerDan Gohman <gohman@apple.com>2007-09-24 20:58:13 +0000
commit189f80dc253664627253b2d2cb07d0714feb12ba (patch)
tree724dc40bd2df104662e57d7058fe907f321fbde1
parentb42abebe36f1dfbd0c779fd1471618c42ed3fec5 (diff)
downloadexternal_llvm-189f80dc253664627253b2d2cb07d0714feb12ba.zip
external_llvm-189f80dc253664627253b2d2cb07d0714feb12ba.tar.gz
external_llvm-189f80dc253664627253b2d2cb07d0714feb12ba.tar.bz2
Add a routine for emitting .file directives, for setting up
file numbers to use with .loc directives. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42272 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/CodeGen/AsmPrinter.h3
-rw-r--r--lib/CodeGen/AsmPrinter.cpp11
2 files changed, 14 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h
index 4a312a7..0ca7cfc 100644
--- a/include/llvm/CodeGen/AsmPrinter.h
+++ b/include/llvm/CodeGen/AsmPrinter.h
@@ -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
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp
index 6622bcd..521386b 100644
--- a/lib/CodeGen/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter.cpp
@@ -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