diff options
Diffstat (limited to 'contrib/llvm/lib/TableGen/TableGenBackend.cpp')
-rw-r--r-- | contrib/llvm/lib/TableGen/TableGenBackend.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/contrib/llvm/lib/TableGen/TableGenBackend.cpp b/contrib/llvm/lib/TableGen/TableGenBackend.cpp index 09bcc7a..7c8367a 100644 --- a/contrib/llvm/lib/TableGen/TableGenBackend.cpp +++ b/contrib/llvm/lib/TableGen/TableGenBackend.cpp @@ -1,4 +1,4 @@ -//===- TableGenBackend.cpp - Base class for TableGen Backends ---*- C++ -*-===// +//===- TableGenBackend.cpp - Utilities for TableGen Backends ----*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -11,17 +11,27 @@ // //===----------------------------------------------------------------------===// +#include "llvm/ADT/Twine.h" +#include "llvm/Support/raw_ostream.h" #include "llvm/TableGen/TableGenBackend.h" -#include "llvm/TableGen/Record.h" using namespace llvm; -void TableGenBackend::anchor() { } - -void TableGenBackend::EmitSourceFileHeader(StringRef Desc, - raw_ostream &OS) const { - OS << "//===- TableGen'erated file -------------------------------------*-" - " C++ -*-===//\n//\n// " << Desc << "\n//\n// Automatically generate" - "d file, do not edit!\n//\n//===------------------------------------" - "----------------------------------===//\n\n"; +static void printLine(raw_ostream &OS, const Twine &Prefix, char Fill, + StringRef Suffix) { + uint64_t Pos = OS.tell(); + OS << Prefix; + for (unsigned i = OS.tell() - Pos, e = 80 - Suffix.size(); i != e; ++i) + OS << Fill; + OS << Suffix << '\n'; } +void llvm::emitSourceFileHeader(StringRef Desc, raw_ostream &OS) { + printLine(OS, "/*===- TableGen'erated file ", '-', "*- C++ -*-===*\\"); + printLine(OS, "|*", ' ', "*|"); + printLine(OS, "|* " + Desc, ' ', "*|"); + printLine(OS, "|*", ' ', "*|"); + printLine(OS, "|* Automatically generated file, do not edit!", ' ', "*|"); + printLine(OS, "|*", ' ', "*|"); + printLine(OS, "\\*===", '-', "===*/"); + OS << '\n'; +} |