[llvm-commits] [llvm] r158723 - /llvm/trunk/lib/TableGen/TableGenBackend.cpp
Benjamin Kramer
benny.kra at googlemail.com
Tue Jun 19 10:04:16 PDT 2012
Author: d0k
Date: Tue Jun 19 12:04:16 2012
New Revision: 158723
URL: http://llvm.org/viewvc/llvm-project?rev=158723&view=rev
Log:
Emit TableGen's header comment with C-style comments, so it can be used from C89 code.
Should silence warnings when compiling the X86 disassembler.
Modified:
llvm/trunk/lib/TableGen/TableGenBackend.cpp
Modified: llvm/trunk/lib/TableGen/TableGenBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TableGenBackend.cpp?rev=158723&r1=158722&r2=158723&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/TableGenBackend.cpp (original)
+++ llvm/trunk/lib/TableGen/TableGenBackend.cpp Tue Jun 19 12:04:16 2012
@@ -11,13 +11,27 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/ADT/Twine.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TableGen/TableGenBackend.h"
using namespace llvm;
+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) {
- OS << "//===- TableGen'erated file -------------------------------------*-"
- " C++ -*-===//\n//\n// " << Desc << "\n//\n// Automatically generate"
- "d file, do not edit!\n//\n//===------------------------------------"
- "----------------------------------===//\n\n";
+ 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';
}
More information about the llvm-commits
mailing list