2003-10-05 21:27:59 +02:00
|
|
|
//===- TableGenBackend.cpp - Base class for TableGen Backends ---*- C++ -*-===//
|
2005-04-22 02:00:37 +02:00
|
|
|
//
|
2003-10-20 22:20:30 +02: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 02:00:37 +02:00
|
|
|
//
|
2003-10-20 22:20:30 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
2003-10-05 21:27:59 +02:00
|
|
|
//
|
|
|
|
// This file provides useful services for TableGen backends...
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "TableGenBackend.h"
|
|
|
|
#include "Record.h"
|
|
|
|
#include <iostream>
|
2004-08-01 05:55:39 +02:00
|
|
|
using namespace llvm;
|
2003-11-11 23:41:34 +01:00
|
|
|
|
2003-10-05 21:27:59 +02:00
|
|
|
void TableGenBackend::EmitSourceFileHeader(const std::string &Desc,
|
|
|
|
std::ostream &OS) const {
|
|
|
|
OS << "//===- TableGen'erated file -------------------------------------*-"
|
|
|
|
" C++ -*-===//\n//\n// " << Desc << "\n//\n// Automatically generate"
|
|
|
|
"d file, do not edit!\n//\n//===------------------------------------"
|
2004-08-17 05:08:28 +02:00
|
|
|
"----------------------------------===//\n\n";
|
2003-10-05 21:27:59 +02: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();
|
|
|
|
}
|
|
|
|
|