2003-08-06 04:23:04 +00:00
|
|
|
//===- TableGenBackend.cpp - Base class for TableGen Backends ---*- C++ -*-===//
|
2005-04-22 00:00:37 +00:00
|
|
|
//
|
2003-10-20 20:20:30 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
2005-04-22 00:00:37 +00:00
|
|
|
//
|
2003-10-20 20:20:30 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2003-08-06 04:23:04 +00:00
|
|
|
//
|
|
|
|
// This file provides useful services for TableGen backends...
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "TableGenBackend.h"
|
2003-08-06 04:31:26 +00:00
|
|
|
#include "Record.h"
|
2003-08-06 04:23:04 +00:00
|
|
|
#include <iostream>
|
2004-08-01 03:55:39 +00:00
|
|
|
using namespace llvm;
|
2003-11-11 22:41:34 +00:00
|
|
|
|
2003-08-06 04:23:04 +00:00
|
|
|
void TableGenBackend::EmitSourceFileHeader(const std::string &Desc,
|
2003-08-06 04:31:26 +00:00
|
|
|
std::ostream &OS) const {
|
2003-08-06 04:23:04 +00:00
|
|
|
OS << "//===- TableGen'erated file -------------------------------------*-"
|
|
|
|
" C++ -*-===//\n//\n// " << Desc << "\n//\n// Automatically generate"
|
|
|
|
"d file, do not edit!\n//\n//===------------------------------------"
|
2004-08-17 03:08:28 +00:00
|
|
|
"----------------------------------===//\n\n";
|
2003-08-06 04:23:04 +00:00
|
|
|
}
|
|
|
|
|
2003-08-06 04:31:26 +00:00
|
|
|
/// getQualifiedName - Return the name of the specified record, with a
|
|
|
|
/// namespace qualifier if the record contains one.
|
|
|
|
///
|
|
|
|
std::string TableGenBackend::getQualifiedName(Record *R) const {
|
|
|
|
std::string Namespace = R->getValueAsString("Namespace");
|
|
|
|
if (Namespace.empty()) return R->getName();
|
|
|
|
return Namespace + "::" + R->getName();
|
|
|
|
}
|
|
|
|
|